Line 68... |
Line 68... |
wire[63:0] tmp_rd; // Temporary read data
|
wire[63:0] tmp_rd; // Temporary read data
|
wire[63:0] tmp_wd; // Temporary write data
|
wire[63:0] tmp_wd; // Temporary write data
|
integer i; // Index
|
integer i; // Index
|
|
|
// Initialization
|
// Initialization
|
`ifdef DEBUG
|
`ifdef SIMPLY_RISC_DEBUG
|
initial begin
|
initial begin
|
$display("INFO: MEMH %m: Memory Harness with Wishbone Slave interface starting...");
|
$display("INFO: MEMH %m: Memory Harness with Wishbone Slave interface starting...");
|
$display("INFO: MEMH %m: %0d Address Bits / %0d Doublewords / %0d Bytes Total Memory", addr_bits, addr_max+1, (addr_max+1)*8);
|
$display("INFO: MEMH %m: %0d Address Bits / %0d Doublewords / %0d Bytes Total Memory", addr_bits, addr_max+1, (addr_max+1)*8);
|
for(i=0; i<=addr_max; i=i+1) mem[i] = memdefaultcontent;
|
for(i=0; i<=addr_max; i=i+1) mem[i] = memdefaultcontent;
|
$readmemh(memfilename, mem);
|
$readmemh(memfilename, mem);
|
Line 102... |
Line 102... |
|
|
// Return the data (ignore the byte select for reads)
|
// Return the data (ignore the byte select for reads)
|
wbs_data_o = tmp_rd;
|
wbs_data_o = tmp_rd;
|
|
|
// Write a comment
|
// Write a comment
|
`ifdef DEBUG
|
`ifdef SIMPLY_RISC_DEBUG
|
if(wbs_sel_i) $display("INFO: MEMH %m: R @ %t ns, AD=%X SEL=%X DAT=%X", $time, wbs_addr_i, wbs_sel_i, wbs_data_o);
|
if(wbs_sel_i) $display("INFO: MEMH %m: R @ %t ns, AD=%X SEL=%X DAT=%X", $time, wbs_addr_i, wbs_sel_i, wbs_data_o);
|
`endif
|
`endif
|
|
|
// Write cycle
|
// Write cycle
|
end else if(wbs_cycle_i & wbs_strobe_i & wbs_we_i) begin
|
end else if(wbs_cycle_i & wbs_strobe_i & wbs_we_i) begin
|
Line 119... |
Line 119... |
|
|
// Store the data
|
// Store the data
|
mem[wbs_addr_i[addr_bits+2:3]] = tmp_wd;
|
mem[wbs_addr_i[addr_bits+2:3]] = tmp_wd;
|
|
|
// Write a comment
|
// Write a comment
|
`ifdef DEBUG
|
`ifdef SIMPLY_RISC_DEBUG
|
if(wbs_sel_i) $display("INFO: MEMH %m: W @ %t ns, AD=%X SEL=%X DAT=%X", $time, wbs_addr_i, wbs_sel_i, tmp_wd);
|
if(wbs_sel_i) $display("INFO: MEMH %m: W @ %t ns, AD=%X SEL=%X DAT=%X", $time, wbs_addr_i, wbs_sel_i, tmp_wd);
|
`endif
|
`endif
|
|
|
// No read/write cycle
|
// No read/write cycle
|
end else begin
|
end else begin
|