Skip to content

Commit 79845b7

Browse files
kerimturakkrmtrk
andauthored
L2cache (#1)
* feat: Integrate L2 cache support and enhance memory management - Added L2 cache module (l2_cache_top_v2.sv) for improved memory performance with non-blocking write-back capabilities. - Updated memory arbiter and CPU modules to accommodate L2 cache interactions and downstream stall handling. - Enhanced fetch and execution stages to manage flush cycles and stall conditions effectively. - Refactored memory request handling to support uncached transactions and store buffer management. - Modified parameter definitions in ceres_param.sv to include L2 cache configurations and derived parameters. - Updated build scripts to include new L2 cache source files and configurations. * refactor: Update CPU and memory modules for improved pipeline handling and introduce store buffer - Renamed `pipe2_drained_q` to `pipe2_frozen` in the CPU module for clarity in stall handling. - Removed redundant logic for tracking pipe2 drainage, simplifying the pipeline control flow. - Enhanced memory module with a new store buffer implementation to manage store transactions and forwarding. - Updated `ceres_param.sv` to define parameters for the store buffer, including depth and pointer width. - Improved memory request handling to accommodate new store buffer functionality and maintain pipeline integrity. * refactor: Standardize signal declarations in CPU and memory modules - Introduced `logic` type for various signals in the CPU, memory, and cache modules to enhance clarity and consistency. - Replaced `wire` declarations with `logic` for signals such as `fi_start`, `fi_has_dirty`, and `dcache_busy` to improve readability and maintainability. - Updated assignments for these signals to ensure proper functionality within the modules. - Enhanced overall code structure by ensuring uniformity in signal types across the design. * refactor: Replace l2_cache_top_v2 with nbmbmp_l2_cache and remove legacy files - Replaced the existing L2 cache module (l2_cache_top_v2.sv) with a new implementation (nbmbmp_l2_cache.sv) that supports non-blocking write-back capabilities. - Deleted the old l2_cache.sv file to eliminate redundancy and streamline the codebase. - Updated the CPU module to instantiate the new nbmbmp_l2_cache, ensuring compatibility with the revised memory architecture. - Made minor adjustments to parameter definitions in ceres_param.sv to reflect the new cache structure. * refactor: Transition from CERES to Level RISC-V across project files - Updated project references from CERES to Level RISC-V in various files, including documentation, makefiles, and configuration scripts. - Modified .gitignore to track new Level RISC-V specific directories and files. - Adjusted svlint configuration to reflect the new project name. - Enhanced README and mkdocs.yml for consistent branding and updated documentation links. - Refactored OpenLane scripts to align with the Level RISC-V design structure. - Removed obsolete files related to the CERES project to streamline the codebase. * refactor: Update makefile and documentation for SIM_FAST integration - Renamed FAST_SIM to SIM_FAST in the makefile for consistency and clarity. - Updated related documentation and examples to reflect the new SIM_FAST variable. - Added mkdocs_hooks.py to manage the generation of the test results dashboard. - Enhanced .gitignore to exclude generated dashboard files and updated README with dashboard usage instructions. - Introduced new dashboard preview images for improved documentation. --------- Co-authored-by: Kerim Turak <kerimturak@hotmail.com>
1 parent e59adf7 commit 79845b7

423 files changed

Lines changed: 20791 additions & 26772 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/copilot-instructions.md

Lines changed: 26 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
# Copilot Instructions for CERES RISC-V Project
1+
# Copilot Instructions for Level RISC-V Project
22

33
## Project Overview
44

5-
This is **CERES RISC-V** - a lightweight, modular 32-bit RISC-V processor core implementing the **RV32IMC** instruction set with CSR and FENCE support. The project is designed for learning, experimentation, and FPGA deployment.
5+
This is **Level RISC-V** - a lightweight, modular 32-bit RISC-V processor core implementing the **RV32IMC** instruction set with CSR and FENCE support. The project is designed for learning, experimentation, and FPGA deployment.
66

77
## Technology Stack
88

99
- **Hardware Description Language**: SystemVerilog (IEEE 1800-2017)
10-
- **Simulation Tools**: Verilator (primary), ModelSim, Icarus Verilog
10+
- **Simulation Tools**: Verilator (primary), ModelSim
1111
- **Synthesis**: Yosys
1212
- **Toolchain**: riscv32-unknown-elf-gcc
1313
- **Scripting**: Python 3, Bash/Zsh, Make
@@ -34,7 +34,7 @@ rtl/ # RTL source files
3434
│ ├── cpu.sv # Top-level CPU module
3535
│ └── hazard_unit.sv # Pipeline hazard handling
3636
├── include/ # Header files (.svh)
37-
│ ├── ceres_defines.svh # Global defines & feature flags
37+
│ ├── level_defines.svh # Global defines & feature flags
3838
│ ├── exception_priority.svh # Exception handling
3939
│ ├── fetch_log.svh # Fetch stage logging
4040
│ └── writeback_log.svh # Writeback logging
@@ -50,7 +50,7 @@ rtl/ # RTL source files
5050
│ ├── wdt/ # Watchdog timer
5151
│ └── vga/ # VGA controller
5252
├── pkg/ # SystemVerilog packages
53-
│ └── ceres_param.sv # Central configuration (1000+ lines)
53+
│ └── level_param.sv # Central configuration (1000+ lines)
5454
├── ram/ # Memory modules
5555
├── tracer/ # Instruction tracer (Konata support)
5656
├── util/ # Utility modules
@@ -62,13 +62,7 @@ sim/ # Simulation files
6262
└── do/ # ModelSim DO files
6363
6464
script/ # Build and test scripts
65-
├── makefiles/ # Modular makefiles
66-
│ ├── config/ # Configuration (config.mk, profiles.mk, paths.mk)
67-
│ ├── sim/ # Simulator configs (verilator.mk, modelsim.mk)
68-
│ ├── test/ # Test runners (isa, arch, imperas, coremark)
69-
│ ├── synth/ # Synthesis (yosys.mk)
70-
│ ├── lint/ # Linting rules
71-
│ └── tools/ # Utilities (clean, waveform viewers)
65+
├── makefiles/ # Optional local.mk (config/); rules live in repo root makefile
7266
├── python/ # Python utilities
7367
├── shell/ # Shell scripts
7468
└── config/ # JSON test configurations
@@ -105,14 +99,14 @@ build/ # Build outputs
10599
- Filename matches module name
106100
- Headers in `rtl/include/` with `.svh` extension
107101
- Packages in `rtl/pkg/` with `_pkg.sv` or `_param.sv` suffix
108-
- Import `ceres_param` package for all parameters
102+
- Import `level_param` package for all parameters
109103

110104
### Code Example Template
111105

112106
```systemverilog
113107
// Module description
114108
module module_name
115-
import ceres_param::*;
109+
import level_param::*;
116110
#(
117111
parameter int PARAM_NAME = 32
118112
) (
@@ -168,7 +162,7 @@ endmodule
168162
- **PMP/PMA**: Physical Memory Protection
169163
- **Bus**: Wishbone B4 compatible
170164

171-
### Core Parameters (from `ceres_param.sv`)
165+
### Core Parameters (from `level_param.sv`)
172166

173167
```systemverilog
174168
// Core
@@ -230,7 +224,7 @@ GPIO_WIDTH = 32
230224
| `cs_reg_file` | `rtl/core/stage03_execute/cs_reg_file.sv` | CSR register file |
231225
| `memory_stage` | `rtl/core/stage04_memory/` | Memory access |
232226
| `writeback_stage` | `rtl/core/stage05_writeback/` | Register writeback |
233-
| `ceres_param` | `rtl/pkg/ceres_param.sv` | All parameters & types |
227+
| `level_param` | `rtl/pkg/level_param.sv` | All parameters & types |
234228

235229
---
236230

@@ -242,13 +236,10 @@ GPIO_WIDTH = 32
242236
# === BUILD ===
243237
make verilate # Build Verilator model
244238
make compile # Compile with ModelSim
245-
make iverilog # Compile with Icarus Verilog
246239

247240
# === SIMULATION ===
248-
make simulate # Run batch simulation (ModelSim)
249-
make simulate_gui # Run GUI simulation with waveforms
241+
make simulate # ModelSim/Questa (add GUI=1 for GUI)
250242
make run_verilator # Run Verilator simulation
251-
make run_icarus # Run Icarus simulation
252243

253244
# === TEST SUITES ===
254245
make isa # All ISA tests (riscv-tests)
@@ -270,8 +261,8 @@ make run_batch # Run multiple tests from list
270261
make list_tests # List available tests
271262

272263
# === COREMARK ===
273-
make cm # Build and run CoreMark
274-
make cm_run # Quick CoreMark run (skip rebuild)
264+
make run_coremark # Build (if needed) + run CoreMark on Verilator
265+
make run_coremark # CoreMark: build if needed + Verilator sim
275266
make coremark # Build CoreMark only
276267
make coremark_help # Show CoreMark help
277268

@@ -330,7 +321,7 @@ MODE=test # RISC-V test mode with assertions
330321
make run T=rv32ui-p-add LOG_COMMIT=1
331322

332323
# Run CoreMark in fast mode with branch stats
333-
make cm SIM_FAST=1 LOG_BP=1 SIM_UART_MONITOR=1
324+
make run_coremark SIM_FAST=1 LOG_BP=1 SIM_UART_MONITOR=1
334325

335326
# Run all ISA tests with commit log
336327
make isa LOG_COMMIT=1
@@ -355,7 +346,7 @@ The makefile auto-detects test type from name:
355346

356347
---
357348

358-
## Feature Flags (ceres_defines.svh)
349+
## Feature Flags (level_defines.svh)
359350

360351
```systemverilog
361352
// Multiplier implementation (only one active)
@@ -429,15 +420,15 @@ The makefile auto-detects test type from name:
429420

430421
1. Create file in appropriate `rtl/` subdirectory
431422
2. Follow naming conventions (lowercase, underscores)
432-
3. Import `ceres_param` package: `import ceres_param::*;`
433-
4. Add to filelist in `script/makefiles/config/sources.mk`
423+
3. Import `level_param` package: `import level_param::*;`
424+
4. Add the new file path to `rtl/flist.f` (one `rtl/...` path per line; `makefile` reads `SV_SOURCES` from there)
434425
5. Update testbench if needed
435426
6. Run `make lint` to verify
436427

437428
### Adding a New Peripheral
438429

439430
1. Create directory under `rtl/periph/`
440-
2. Define register offsets in `ceres_param.sv`
431+
2. Define register offsets in `level_param.sv`
441432
3. Add to peripheral bus decoder
442433
4. Create software header file
443434
5. Add test program in `sim/test/`
@@ -479,7 +470,7 @@ make formal_prove # Proof mode
479470
2. **Active Development**: Check `docs/AI_ENHANCEMENT_PLANS.md` for planned features
480471
3. **Testing**: Always run `make quick` or `make lint` before committing
481472
4. **Formal**: Use `make formal` for formal verification checks
482-
5. **Package**: Always import `ceres_param` for parameters and types
473+
5. **Package**: Always import `level_param` for parameters and types
483474
6. **Reset**: Active-low reset (`i_rst_n`), synchronous design
484475

485476
---
@@ -488,26 +479,26 @@ make formal_prove # Proof mode
488479

489480
| File | Purpose |
490481
|------|---------|
491-
| `rtl/pkg/ceres_param.sv` | **Central config** - ALL parameters, types, enums, structs |
492-
| `rtl/include/ceres_defines.svh` | Feature flags, trace controls |
482+
| `rtl/pkg/level_param.sv` | **Central config** - ALL parameters, types, enums, structs |
483+
| `rtl/include/level_defines.svh` | Feature flags, trace controls |
493484
| `rtl/core/cpu.sv` | Top-level CPU module |
494485
| `rtl/core/hazard_unit.sv` | Pipeline hazard detection |
495-
| `script/makefiles/config/config.mk` | Build configuration |
496-
| `script/makefiles/config/profiles.mk` | Build profiles (debug/release/test) |
497-
| `makefile` | Top-level build entry point |
486+
| `makefile` | **Unified** build/test rules (paths, toolchain, Verilator, tests, synth) |
487+
| `rtl/flist.f` | RTL file list → `SV_SOURCES` (one `rtl/...` path per line) |
488+
| `script/makefiles/config/local.mk` | Optional local overrides (`-include`) |
498489
| `docs/architecture.md` | Full architecture documentation |
499490
| `docs/INDEX.md` | Documentation index |
500491

501492
---
502493

503-
## Enumeration Types (from ceres_param.sv)
494+
## Enumeration Types (from level_param.sv)
504495

505496
Common enums used throughout RTL - always use these instead of magic numbers:
506497

507498
```systemverilog
508499
// ALU operations, branch types, memory operations, CSR operations
509500
// Exception codes, privilege levels, etc.
510-
// See rtl/pkg/ceres_param.sv for complete list
501+
// See rtl/pkg/level_param.sv for complete list
511502
```
512503

513504
---

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# ============================================================
2-
# CERES RISC-V — Continuous Integration Pipeline
2+
# Level RISC-V — Continuous Integration Pipeline
33
# ============================================================
44
# Triggers on push and pull requests to main branch
55
# Runs ISA tests, Architecture tests, and generates reports
66
# ============================================================
77

8-
name: CERES CI
8+
name: LEVEL CI
99

1010
on:
1111
# push:
@@ -345,7 +345,7 @@ jobs:
345345
steps:
346346
- name: Check test results
347347
run: |
348-
echo "## CERES RISC-V Test Results" >> $GITHUB_STEP_SUMMARY
348+
echo "## Level RISC-V Test Results" >> $GITHUB_STEP_SUMMARY
349349
echo "" >> $GITHUB_STEP_SUMMARY
350350
echo "| Job | Status |" >> $GITHUB_STEP_SUMMARY
351351
echo "|-----|--------|" >> $GITHUB_STEP_SUMMARY

.gitignore

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,20 @@ riscv-privileged.pdf
1414
riscv-unprivileged.pdf
1515
# MkDocs site
1616
site/
17+
# Copied from results/logs by mkdocs_hooks.py (do not commit)
18+
docs/dashboard.html
1719
*/__pycache__/
1820
*.pyc
1921

20-
# Allow tracking spike-pk inside env/coremark (coremark is globally ignored)
22+
# Track CoreMark port sources under env/coremark (name "coremark" may be ignored elsewhere)
2123
!env/coremark/
22-
!env/coremark/spike-pk/
23-
!env/coremark/spike-pk/**
24+
!env/coremark/levelv/
25+
!env/coremark/levelv/**
2426
!env/coremark/minimal/
2527
!env/coremark/minimal/**
2628

2729
# OpenLane generated artifacts
28-
asic/openlane/designs/ceres_wrapper/src/
29-
asic/openlane/designs/ceres_wrapper/runs/
30-
asic/openlane/designs/ceres_wrapper/sources_manifest.txt
31-
asic/openlane/designs/ceres_wrapper/src/ceres_wrapper_sv2v.v
30+
asic/openlane/designs/level_wrapper/src/
31+
asic/openlane/designs/level_wrapper/runs/
32+
asic/openlane/designs/level_wrapper/sources_manifest.txt
33+
asic/openlane/designs/level_wrapper/src/level_wrapper_sv2v.v

.svlint.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# =========================================
2-
# svlint Configuration for CERES RISC-V
2+
# svlint Configuration for Level RISC-V
33
# https://github.com/dalance/svlint
44
# =========================================
55

0 commit comments

Comments
 (0)