summaryrefslogtreecommitdiff
path: root/eater_cpu/eater_register.v
blob: 52c53a48217016cecf0d79bb9a12e208fe15e99c (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
37
38
`timescale 1us/1us

`ifndef EATER_REGISTER
`define EATER_REGISTER

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

  // store data on rising clk?
  input en_store_in,
  // async - output data to bus
  input en_output_in,

  input [(DATA_WIDTH-1) : 0] data_in,
  output [(DATA_WIDTH-1) : 0] bus_out,
  output [(DATA_WIDTH-1) : 0] always_out
  // inout [(DATA_WIDTH-1) : 0] data
  
);

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

always @(posedge clk_in) begin
  if (en_store_in) begin
    r_datastore <= data_in;
    // r_datastore <= data;
  end
end

assign bus_out = en_output_in ? r_datastore : 8'bz;
assign always_out = r_datastore;
// assign data = en_output_in ? r_datastore : 8'bz;

endmodule

`endif