it's been a while

This commit is contained in:
Yehowshua Immanuel 2024-03-20 02:25:31 -04:00
parent 9f90b00b25
commit e44f6b083b
11 changed files with 78 additions and 4 deletions

BIN
experiments/bram/.DS_Store vendored Normal file

Binary file not shown.

View file

@ -0,0 +1,56 @@
// bsc -sim -u -g mkTestbench Testbench.bsv; bsc -sim -e mkTestbench -o simBRAM; ./simBRAM -V
import BRAM::*;
import StmtFSM::*;
import Clocks::*;
function BRAMRequest#(Bit#(8), Bit#(8)) makeRequest(Bool write, Bit#(8) addr, Bit#(8) data);
return BRAMRequest{
write: write,
responseOnWrite:False,
address: addr,
datain: data
};
endfunction
(* synthesize *)
module mkTestbench();
Reg#(UInt#(3)) count <- mkReg(0);
BRAM_Configure cfg = defaultValue;
cfg.allowWriteResponseBypass = False;
// BRAM2Port#(Bit#(8), Bit#(8)) dut0 <- mkBRAM2Server(cfg);
cfg.loadFormat = tagged Hex "bram2.txt";
BRAM1Port#(Bit#(8), Bit#(8)) dut1 <- mkBRAM1Server(cfg);
rule counting;
count <= count + 1;
endrule
//Define StmtFSM to run tests
Stmt test =
(seq
delay(10);
action
$display("count = %d", count);
dut1.portA.request.put(makeRequest(False, 0, 0));
endaction
action
$display("count = %d", count);
$display("dut1read[0] = %x", dut1.portA.response.get);
dut1.portA.request.put(makeRequest(False, 1, 0));
endaction
action
$display("count = %d", count);
$display("dut1read[1] = %x", dut1.portA.response.get);
dut1.portA.request.put(makeRequest(False, 2, 0));
endaction
action
$display("count = %d", count);
$display("dut1read[2] = %x", dut1.portA.response.get);
endaction
delay(100);
action
$finish();
endaction
endseq);
mkAutoFSM(test);
endmodule

View file

@ -0,0 +1,4 @@
fe
ed
f0
0d

View file

@ -0,0 +1,14 @@
# bluetcl sim_inspect.tcl
namespace import ::Bluetcl::*
package require Bluesim
sim load simBRAM.so mkTestbench
set count_hdl [sim lookup count]
set bram [sim lookup dut1_memory]
sim step
sim step
sim step
puts "Value of count: [sim get $count_hdl]"
puts "Value of bram\[0:3\]: [sim getrange $bram 0 3]"