summaryrefslogtreecommitdiff
path: root/rtl/core/regs/file.sv
blob: e0f9b4c65450151dc9e8cecd11c23a5d1a30dc54 (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
`include "core/uarch.sv"

module core_reg_file
(
	input  logic     clk,
	input  reg_index rd_index,
	                 wr_index,
	input  logic     wr_enable,
	input  word      wr_value,

	output word      rd_value
);

	// Ver comentario en uarch.sv
	word file[30] /*verilator public*/;

	//FIXME: Esto claramente no sirve
`ifdef VERILATOR
	always_ff @(negedge clk) begin
`else
	always_ff @(posedge clk) begin
`endif
		if(wr_enable)
			file[wr_index] <= wr_value;

		rd_value <= file[rd_index];
	end

endmodule