- Simulation: SystemVerilog compatible simulator (Vivado XSim, Verilator, Questasim/ModelSim, or Icarus Verilog with v12+).
- Synthesis: Xilinx Vivado (2020.2 or later recommended).
.
├── docs/ # Documentation
├── rtl/ # Source Code
│ ├── common/ # Shared modules (Arbiter, SRAM)
│ ├── include/ # Packages and Interfaces
│ ├── l1_cache/ # L1 I/D Cache Logic
│ ├── l2_cache/ # L2 Unified Cache Logic
│ └── l3_cache/ # L3 Last Level Cache Logic
├── scripts/ # Build/Run Scripts
└── tb/ # Testbench Files
The testbench tb_hierarchical_cache verifies the end-to-end flow from CPU -> L1 -> L2 -> L3 -> Memory.
Icarus Verilog has limited support for complex SystemVerilog hierarchies. To resolve this, use the provided concat.py script to generate a single-file version of the RTL and TB.
- Generate Single File:
python concat.py
- Compile and Run:
iverilog -g2012 -s tb_hierarchical_cache -o sim.vvp all_in_one.sv vvp sim.vvp
- Open Vivado.
- In Tcl Console, add files:
add_files [glob rtl/include/*.sv rtl/common/*.sv rtl/l1_cache/*.sv rtl/hierarchical_cache_top.sv tb/*.sv] - Run Simulation -> Run Behavioral Simulation.
To verify the design is synthesizable and check resource utilization:
- Open a terminal (or Vivado Tcl Console).
- Run the provided script:
vivado -mode batch -source scripts/run_vivado_synth.tcl
- Check
synthesis_utilization.rptfor area results.
- Instantiate
hierarchical_cache_topin your SoC wrapper. - Connect
clkandrst_n. - Provide interface structs:
cpu_l1i_req_i/cpu_l1i_resp_ofor Instruction Fetch.cpu_l1d_req_i/cpu_l1d_resp_ofor Data Access.mem_req_o/mem_resp_ito your DDR Controller or Memory Model.
- See
docs/INTERFACE.mdfor signal details.