Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion src/rtl/tc_sram.sv
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,18 @@ module tc_sram #(
addr_t [NumPorts-1:0] r_addr_q;

// SRAM simulation initialization
// Keep the `init_val` declaration visible to synthesis.
// The random/behavioral initialization is simulation-only and relies on `$urandom`,
// which synthesis tools cannot elaborate inside a function body.
data_t init_val[NumWords-1:0];
// pragma translate_off
function automatic data_t random_init_word();
random_init_word = '0;
for (int unsigned b = 0; b < DataWidth; b += 32) begin
random_init_word = (random_init_word << 32) | data_t'($urandom());
end
endfunction

data_t init_val[NumWords-1:0];
initial begin : proc_sram_init
for (int unsigned i = 0; i < NumWords; i++) begin
unique case (SimInit)
Expand All @@ -106,6 +110,7 @@ module tc_sram #(
endcase
end
end
// pragma translate_on

// set the read output if requested
// The read data at the highest array index is set combinational.
Expand Down