Add instruction cache and store-load forwarding #18
this would feed the data to all addresses, not only RAM. but since will be using MMIO as well, this will be problematic. Add a mux select to keep it only in the RAM region.
Ideally add this as a test in the test_icache.py as well
why pad with only 0s? shouldn't it be padded with sign?
The old code replicated the 1-bit result 32 times, so when true it produced 0xFFFFFFFF (-1) instead of 0x00000001 (1). SLTI and SLTIU are boolean comparison instructions that must return 0 or 1 per the RISC-V spec. Zero-padding the 1-bit result gives 0x00000000 for false and 0x00000001 for true, which matches the spec.
made the changes
why remove initial begin?
keep this INSTR_MEM_SIZE
what is this tab doing her?
keep same style format everwhere
this is not needed imo
there are two stall pipelines wires?
this is not necessary
write the total in MB here in comments for understanding
why this change?
Requested changes.
fixing the boolean logic of set instruction
In INSTR_MEM_SIZE it also allows 0x00080000 but the memory addresses are only till 0x0007FFFF
donezo
removed
removed
removed
okays
removed
added
nice catch!
you haven't updated the commit even though I see you have made some comments?
there's an extra SLT now?
yeah got it! nice!
we should use riscv-unknown-elf-gcc only here
why the change?
imo this is a very big diff that is not possible to review in one PR. my bad. I think you should separate this work into 3 PRs.
one, where you add icache, one where you fix the SLTI/SLTIU bug and the third one where we fix the memory map.
this allows me to review your work thoroughly and with no mistakes.
@spr4bhu
There's no extra SLT
just fixed the output to be boolean
closing this since we don't need this anymore.
5iri
spr4bhu
Add Instruction Cache and Store-Load Forwarding
Changes
- Instruction Cache: 4-way set-associative cache (4KB) with round-robin replacement and FENCE.I support
- Store-Load Forwarding: Detects memory hazards and forwards store data directly to loads, bypassing memory
- Tests: Added tests for both features (test_icache.py, test_store_load.py)
The instruction cache reduces fetch latency for frequently executed code. Store-load forwarding ensures memory consistency
without pipeline stalls.