This commit is contained in:
David Harris 2021-02-02 13:42:35 -05:00
commit 587a343dac
3 changed files with 31 additions and 18 deletions

3
.gitignore vendored
View File

@ -1,4 +1,5 @@
**/work **/work*
**/wally_*.log
#vsim work files to ignore #vsim work files to ignore
transcript transcript

View File

@ -18,8 +18,8 @@
onbreak {resume} onbreak {resume}
# create library # create library
if [file exists work] { if [file exists work$2] {
vdel -all vdel -lib work$2 -all
} }
vlib work$2 vlib work$2

View File

@ -162,21 +162,33 @@ module testbench_busybear();
end end
end end
string CSRname; `define CHECK_CSR(CSR) \
logic [63:0] expectedCSR; string CSR; \
//CSR checking logic [63:0] expected``CSR``; \
always @(dut.priv.MTVEC_REGW) begin //CSR checking \
if ($time != 1) begin always @(dut.priv.csr.``CSR``_REGW) begin \
scan_file_csr = $fscanf(data_file_csr, "%s\n", CSRname); if ($time > 1) begin \
scan_file_csr = $fscanf(data_file_csr, "%x\n", expectedCSR); scan_file_csr = $fscanf(data_file_csr, "%s\n", CSR); \
if(CSRname != "mtvec") begin scan_file_csr = $fscanf(data_file_csr, "%x\n", expected``CSR``); \
$display("%t ps, instr %0d: MTVEC changed, expected %s", $time, instrs, CSRname); if(CSR.icompare(`"CSR`")) begin \
end $display("%t ps, instr %0d: %s changed, expected %s", $time, instrs, `"CSR`", CSR); \
if(dut.priv.MTVEC_REGW != expectedCSR) begin end \
$display("%t ps, instr %0d: %s does not equal %s expected: %x, %x", $time, instrs, CSRname, CSRname, dut.priv.MTVEC_REGW, expectedCSR); if(dut.priv.csr.``CSR``_REGW != ``expected``CSR) begin \
end $display("%t ps, instr %0d: %s does not equal %s expected: %x, %x", $time, instrs, CSR, CSR, dut.priv.csr.``CSR``_REGW, ``expected``CSR); \
end end \
end end \
end
//`CHECK_CSR(FCSR)
`CHECK_CSR(MCOUNTEREN)
`CHECK_CSR(MEDELEG)
`CHECK_CSR(MIDELEG)
`CHECK_CSR(MIE)
//`CHECK_CSR(MSCRATCH)
`CHECK_CSR(MSTATUS)
`CHECK_CSR(MTVEC)
//`CHECK_CSR(SATP)
`CHECK_CSR(SCOUNTEREN)
logic speculative; logic speculative;
initial begin initial begin