summaryrefslogtreecommitdiff
path: root/eater_cpu/eater_register.v
blob: 17da7bd09c97728b0196022471141ec1fcd08b8e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
`timescale 1us/1us

`ifndef EATER_REGISTER
`define EATER_REGISTER

module eater_register #(
  parameter DATA_WIDTH = 8
) (
  input clk_i,

  // store data on rising clk?
  input en_store_i,
  // async - output data to bus
  input en_output_i,

  input [(DATA_WIDTH-1) : 0] data_i,
  output [(DATA_WIDTH-1) : 0] data_o
  // inout [(DATA_WIDTH-1) : 0] data
  
);

reg [(DATA_WIDTH-1) : 0] r_datastore /* verilator public */;

always @(posedge clk_i) begin
  if (en_store_i) begin
    r_datastore <= data_i;
    // r_datastore <= data;
  end
end

assign data_o = en_output_i ? r_datastore : 8'bz;
// assign data = en_output_i ? r_datastore : 8'bz;

endmodule

`endif