lowRISC / ibex

Ibex is a small 32 bit RISC-V CPU core, previously known as zero-riscy.
https://www.lowrisc.org
Apache License 2.0
1.33k stars 517 forks source link

How to connect the SRAM generated by the memory compiler to the Ibex core and verify its functionality? #2197

Open tju-sun-lab opened 1 month ago

tju-sun-lab commented 1 month ago

I am currently aiming to tape out a chip using SMIC's 180nm process. I am keeping the ibex core unchanged, but I need to embed SRAM on the chip. I use SMIC's memory compiler to generate the RAM's Verilog and liberty files, but I need to verify whether this SRAM can connect well with the ibex core and function properly. This is because the read/write timing of the SRAM generated by the memory compiler is different from that of prim_ram_2p. The prim_ram_2p can read out data in the current cycle, while the SRAM generated by the memory compiler requires a delay of one cycle to read out data. Therefore, I need to verify whether this SRAM works well; otherwise, I will need to design additional timing control logic.

I want to use the Ibex Simple System for verification. My steps are as follows:

  1. Use the memory compiler to generate SRAM with width=32 and depth=1024*1024/4. By the way, are these parameter selections correct?
  2. Replace prim_ram_2p with SRAM.v and connect the input and output port signals properly.
  3. Compile the Ibex Simple System software to generate the vmem file.
  4. Use ./build/lowrisc_ibex_ibex_simple_system_0/sim-vcs/lowrisc_ibex_ibex_simple_system_0 for simulation verification.

However, the simulation reports errors. It seems that the vmem is not read into the SRAM, and the instructions in the trace_core_00000000.log file are empty, showing INVALID. Is it possible that the SRAM cannot use the $readmemh command to load data? How should I proceed to verify it?

tju-sun-lab commented 1 month ago

The running log and the trace_core are attached as follows. replace_port_b.log trace_core_00000000.log

tju-sun-lab commented 1 month ago

I have used a memory compiler to generate an SRAM with a width of 32 and a depth of 8192. I have instantiated one in prim_generic_ram_2p. Since the memory compiler cannot generate dual-port SRAM, I directly used port A for data RAM. The code is shown as follows. prim_generic_ram_2p

Afterwards, I used VCS to simulate the simple system with the hello_test binary and encountered the following error: ./build_sim_run.sh Chronologic VCS simulator copyright 1991-2022 Contains Synopsys proprietary information. Compiler version T-2022.06_Full64; Runtime version T-2022.06_Full64; Jul 27 16:23 2024 Initializing memory ibex_simple_system.u_ram.u_ram.gen_generic.u_impl_generic.unnamed$$_1.gen_meminit from file './examples/sw/simple_system/hello_test/hello_test.vmem'. ibex_simple_system.u_top.u_ibex_tracer.unnamed$$_1.unnamed$$_2: Writing execution trace to trace_core_00000000.log "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1220: ibex_simple_system.u_top.u_ibex_top.g_no_secure_ibex_mem_assert.IbexDataRPayloadX: started at 3480s failed at 3480s Offending '(!$isunknown({data_rdata_i, data_rdata_intg_i}))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1220: ibex_simple_system.u_top.u_ibex_top.g_no_secure_ibex_mem_assert.IbexDataRPayloadX: at time 3480 3480: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1220) [ibex_simple_system.u_top.u_ibex_top.g_no_secure_ibex_mem_assert.IbexDataRPayloadX] [ASSERT FAILED] IbexDataRPayloadX "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1141: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBranchDecisionValid: started at 3500s failed at 3500s Offending '(!$isunknown(branch_decision_i))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1141: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBranchDecisionValid: at time 3500 3500: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1141) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBranchDecisionValid] [ASSERT FAILED] IbexBranchDecisionValid "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1119: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexAluOpMuxSelKnownKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown(instr_valid_i))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1119: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexAluOpMuxSelKnownKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1119) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexAluOpMuxSelKnownKnownEnable] [ASSERT FAILED] IbexAluOpMuxSelKnownKnownEnable "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1125: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBTAluAOpMuxSelKnownKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown(instr_valid_i))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1125: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBTAluAOpMuxSelKnownKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1125) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBTAluAOpMuxSelKnownKnownEnable] [ASSERT FAILED] IbexBTAluAOpMuxSelKnownKnownEnable "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1129: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBTAluBOpMuxSelKnownKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown(instr_valid_i))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1129: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBTAluBOpMuxSelKnownKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1129) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBTAluBOpMuxSelKnownKnownEnable] [ASSERT FAILED] IbexBTAluBOpMuxSelKnownKnownEnable "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1138: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexWbStateKnown: started at 3520s failed at 3520s Offending '(!$isunknown(id_fsm_q))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1138: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexWbStateKnown: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1138) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexWbStateKnown] [ASSERT FAILED] IbexWbStateKnown "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1141: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBranchDecisionValidKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown((instr_valid_i && (!(illegal_csr_insn_i || instr_fetch_err_i)))))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1141: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBranchDecisionValidKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1141) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexBranchDecisionValidKnownEnable] [ASSERT FAILED] IbexBranchDecisionValidKnownEnable "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1145: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexIdInstrKnownKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown((instr_valid_i && (!(illegal_c_insn_i || instr_fetch_err_i)))))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1145: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexIdInstrKnownKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1145) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexIdInstrKnownKnownEnable] [ASSERT FAILED] IbexIdInstrKnownKnownEnable "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1149: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexIdInstrALUKnownKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown((instr_valid_i && (!(illegal_c_insn_i || instr_fetch_err_i)))))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1149: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexIdInstrALUKnownKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1149) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexIdInstrALUKnownKnownEnable] [ASSERT FAILED] IbexIdInstrALUKnownKnownEnable "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: started at 3520s failed at 3520s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: at time 3520 3520: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1115) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX] [ASSERT FAILED] IbexInstrReqX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: started at 3520s failed at 3520s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: at time 3520 3520: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1116) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable] [ASSERT FAILED] IbexInstrReqPayloadXKnownEnable "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: started at 3520s failed at 3520s Offending '(!$isunknown(instr_gnt_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: at time 3520 3520: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1135) [ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX] [ASSERT FAILED] IbexInstrGntX "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1163: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexMoveToFirstCycleWhenIdReady: started at 3520s failed at 3540s Offending '(id_fsm_q == FIRST_CYCLE)' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1163: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexMoveToFirstCycleWhenIdReady: at time 3540 3540: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1163) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexMoveToFirstCycleWhenIdReady] [ASSERT FAILED] IbexMoveToFirstCycleWhenIdReady "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1138: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexWbStateKnown: started at 3540s failed at 3540s Offending '(!$isunknown(id_fsm_q))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv", 1138: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexWbStateKnown: at time 3540 3540: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_id_stage.sv:1138) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.id_stage_i.IbexWbStateKnown] [ASSERT FAILED] IbexWbStateKnown "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: started at 3540s failed at 3540s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: at time 3540 3540: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1115) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX] [ASSERT FAILED] IbexInstrReqX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: started at 3540s failed at 3540s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: at time 3540 3540: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1116) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable] [ASSERT FAILED] IbexInstrReqPayloadXKnownEnable "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: started at 3540s failed at 3540s Offending '(!$isunknown(instr_gnt_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: at time 3540 3540: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1135) [ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX] [ASSERT FAILED] IbexInstrGntX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1136: ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX: started at 3540s failed at 3540s Offending '(!$isunknown(instr_rvalid_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1136: ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX: at time 3540 3540: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1136) [ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX] [ASSERT FAILED] IbexInstrRValidX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1137: ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable: started at 3540s failed at 3540s Offending '(!$isunknown(instr_rvalid_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1137: ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable: at time 3540 3540: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1137) [ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable] [ASSERT FAILED] IbexInstrRPayloadXKnownEnable "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: started at 3560s failed at 3560s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: at time 3560 3560: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1115) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX] [ASSERT FAILED] IbexInstrReqX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: started at 3560s failed at 3560s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: at time 3560 3560: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1116) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable] [ASSERT FAILED] IbexInstrReqPayloadXKnownEnable "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: started at 3560s failed at 3560s Offending '(!$isunknown(instr_gnt_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: at time 3560 3560: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1135) [ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX] [ASSERT FAILED] IbexInstrGntX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1136: ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX: started at 3560s failed at 3560s Offending '(!$isunknown(instr_rvalid_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1136: ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX: at time 3560 3560: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1136) [ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX] [ASSERT FAILED] IbexInstrRValidX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1137: ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable: started at 3560s failed at 3560s Offending '(!$isunknown(instr_rvalid_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1137: ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable: at time 3560 3560: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1137) [ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable] [ASSERT FAILED] IbexInstrRPayloadXKnownEnable "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_compressed_decoder.sv", 286: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.if_stage_i.compressed_decoder_i.IbexInstrValidKnown: started at 3580s failed at 3580s Offending '(!$isunknown(valid_i))' Error: "../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_compressed_decoder.sv", 286: ibex_simple_system.u_top.u_ibex_top.u_ibex_core.if_stage_i.compressed_decoder_i.IbexInstrValidKnown: at time 3580 3580: (../src/lowrisc_ibex_ibex_core_0.1/rtl/ibex_compressed_decoder.sv:286) [ibex_simple_system.u_top.u_ibex_top.u_ibex_core.if_stage_i.compressed_decoder_i.IbexInstrValidKnown] [ASSERT FAILED] IbexInstrValidKnown "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: started at 3580s failed at 3580s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1115: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX: at time 3580 3580: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1115) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqX] [ASSERT FAILED] IbexInstrReqX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: started at 3580s failed at 3580s Offending '(!$isunknown(instr_req_o))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1116: ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable: at time 3580 3580: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1116) [ibex_simple_system.u_top.u_ibex_top.IbexInstrReqPayloadXKnownEnable] [ASSERT FAILED] IbexInstrReqPayloadXKnownEnable "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: started at 3580s failed at 3580s Offending '(!$isunknown(instr_gnt_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1135: ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX: at time 3580 3580: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1135) [ibex_simple_system.u_top.u_ibex_top.IbexInstrGntX] [ASSERT FAILED] IbexInstrGntX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1136: ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX: started at 3580s failed at 3580s Offending '(!$isunknown(instr_rvalid_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1136: ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX: at time 3580 3580: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1136) [ibex_simple_system.u_top.u_ibex_top.IbexInstrRValidX] [ASSERT FAILED] IbexInstrRValidX "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1137: ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable: started at 3580s failed at 3580s Offending '(!$isunknown(instr_rvalid_i))' Error: "../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv", 1137: ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable: at time 3580 3580: (../src/lowrisc_ibex_ibex_top_0.1/rtl/ibex_top.sv:1137) [ibex_simple_system.u_top.u_ibex_top.IbexInstrRPayloadXKnownEnable] [ASSERT FAILED] IbexInstrRPayloadXKnownEnable

Check the trace_core_00000000.log file and find that it gets stuck at instruction 177, then an error is reported, as shown in the figure below. Instruction 174 seems to be incorrect. I don't understand why x15=0x000000xx; it should be x15=0x00000048. wrong

Expected Behavior should be right

I have attached both the correct log and the incorrect log below. trace_core_00000000_right.log trace_core_00000000_wrong.log

rswarbrick commented 1 month ago

Hi there,

Thank you for the detailed description of what you're trying to do, and what's not working. I think I understand you, and I'm pretty optimistic that we can get things working for you.

My first note is about the assertions. These are basically saying that some control structures are trying to make decisions based on uninitialised data. Practically speaking, this will mean that you've fetched some instruction words from uninitialised memory and are now trying to decode and execute them. As you might expect, this isn't going to work :-)

This matches your description of the log file. If you look closely, notice that the (also) instruction after the lbuat0x00100094` is from a different address in the two cases: the expected trace has an address that goes up by 4, which makes sense. The address in the observed trace goes up by 6. Huh?!

On the plus side, I suspect the root cause is the same in both cases: the fetched instruction data contains x values.

When you say that "prim_ram_2p can read out data in the current cycle", I assume you mean that if we request from an address on cycle N then the data will come back on cycle N+1? (That's the behaviour we expect) And I guess you mean that the SRAM from the memory compiler takes an extra cycle to respond, so you request data on cycle N and the response valid signal will be high on cycle N+2?

For details of the exact timing, I'm going to forward this to @GregAC (who implemented most of the code in question). I can try to work it out by squinting at the implementation, but I'm probably not the best person to answer!

tju-sun-lab commented 1 month ago

Thank you very much for your quick response. I found part of the reason: as you mentioned, I did not read in data during the SRAM initialization. This was my mistake; I assumed that memory initialization only applied to the Instruction memory and not to the data memory. It turns out both parts need to be initialized. I only ported the data memory, keeping the data memory part as the original code. Now that I have initialized the data memory, I can continue to make progress (I simply added the $readmemh statement in the Verilog code for the data memory; I wonder if there is a more convenient way to modify this).

Additionally, after initializing the data memory, although the system can continue running, there are still other errors. I am currently debugging and hope to resolve them. If I am unable to fix them, I will post the issues here and hope to receive your assistance.

tju-sun-lab commented 1 month ago

Hi there,

Thank you for the detailed description of what you're trying to do, and what's not working. I think I understand you, and I'm pretty optimistic that we can get things working for you.

My first note is about the assertions. These are basically saying that some control structures are trying to make decisions based on uninitialised data. Practically speaking, this will mean that you've fetched some instruction words from uninitialised memory and are now trying to decode and execute them. As you might expect, this isn't going to work :-)

This matches your description of the log file. If you look closely, notice that the (also) instruction after the lbuat0x00100094` is from a different address in the two cases: the expected trace has an address that goes up by 4, which makes sense. The address in the observed trace goes up by 6. Huh?!

On the plus side, I suspect the root cause is the same in both cases: the fetched instruction data contains x values.

When you say that "prim_ram_2p can read out data in the current cycle", I assume you mean that if we request from an address on cycle N then the data will come back on cycle N+1? (That's the behaviour we expect) And I guess you mean that the SRAM from the memory compiler takes an extra cycle to respond, so you request data on cycle N and the response valid signal will be high on cycle N+2?

For details of the exact timing, I'm going to forward this to @GregAC (who implemented most of the code in question). I can try to work it out by squinting at the implementation, but I'm probably not the best person to answer!

By the way, may I ask if the default RAM size for the simple system is 1MB? I want to modify it to 32KB (because the memory compiler can only generate a maximum of 32KB RAM). Is this sufficient for the simple system to run? If so, which files should be modified? From my preliminary review, it seems necessary to modify the Device address mapping section in ibex_simple_system.sv. Do the base addresses and masks for RAM, SimCtrl, and Timer all need to be modified? Besides this, which other files need to be changed?