Skip to content

Commit 8a751d6

Browse files
committed
trim READMEs to eliminate dual-source-of-truth drift, add --list CLI flags
The hw/rtl, sw, formal, and tests READMEs had exhaustive listings of every module/app/target that duplicated what was already in code. This created two sources of truth that were already drifting (3 sw apps were undocumented in the old README). - hw/rtl/README: replace file-by-file tree with subdirs-only map; keep the architectural "Module Details" section (high-value, low-drift) - sw/README: replace multi-paragraph app descriptions with a compact 20-row table of one-line summaries covering all apps; point to source-level doc comments as the authoritative detail - formal/README: replace target table with pointer to --list-targets - tests/README: replace test table with pointer to --list-tests - test_run_cocotb.py: add --list-tests flag (single source of truth) - test_run_formal.py: add --list-targets flag (single source of truth)
1 parent 73b3c2e commit 8a751d6

File tree

6 files changed

+108
-326
lines changed

6 files changed

+108
-326
lines changed

formal/README.md

Lines changed: 13 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,17 @@ Each `.sby` file defines a verification target with tasks:
2222

2323
## Targets
2424

25-
| Target | SBY File | Module | Tasks | Properties |
26-
|--------|----------|--------|-------|------------|
27-
| **hru** | `hru.sby` | `hazard_resolution_unit` | bmc, cover, prove | Load-use stall contract, branch flush duration, trap override, MMIO termination, CSR bounded, shift register fill, stale flush prevention |
28-
| **lr_sc** | `lr_sc.sby` | `lr_sc_reservation` | bmc, cover, prove | SC clears reservation, LR sets reservation, SC priority over LR, stall preserves state, reset clears all |
29-
| **trap_unit** | `trap_unit.sby` | `trap_unit` | bmc, cover | Trap/MRET mutex (RTL-enforced trap priority), trap needs source, interrupt priority, vectored offsets, re-entry prevention, WFI stall |
30-
| **csr_file** | `csr_file.sby` | `csr_file` | bmc, cover | Trap saves state, MIE/MPIE management, mepc/mtvec alignment, mip reflects inputs, counter increments, fflags sticky |
31-
| **fwd_unit** | `fwd_unit.sby` | `forwarding_unit` | bmc, cover | MA priority over WB, x0 always zero, no-forward uses raw value, reset clears enables, forward requires write |
32-
| **fp_fwd_unit** | `fp_fwd_unit.sby` | `fp_forwarding_unit` | bmc, cover | Reset/flush clear enables, pending self-clearing, stall matches pending, capture bypass requires write enable |
33-
| **cache_hit** | `cache_hit.sby` | `cache_hit_detector` | bmc, cover | MMIO exclusion, non-load exclusion, tag mismatch exclusion, byte/halfword/word valid bit checks |
34-
| **cache_write** | `cache_write.sby` | `cache_write_controller` | bmc, cover | MMIO stores bypass cache, AMO byte enables, stale load prevention, store valid bit merging |
35-
| **data_mem_arb** | `data_mem_arb.sby` | `data_mem_arbiter` | bmc, cover | Priority encoding (FP > AMO write > AMO stall > default), stall gates stores, AMO gets all bytes |
25+
Formal targets are intentionally documented from code, not duplicated in this README.
26+
The source of truth is `FORMAL_TARGETS` in `tests/test_run_formal.py` plus the `.sby`
27+
files in this directory.
28+
29+
```bash
30+
# List all targets and their supported tasks
31+
./tests/test_run_formal.py --list-targets
32+
33+
# See CLI help (includes --target choices)
34+
./tests/test_run_formal.py --help
35+
```
3636

3737
## Running
3838

@@ -42,6 +42,7 @@ pytest tests/test_run_formal.py
4242

4343
# Standalone runner
4444
./tests/test_run_formal.py
45+
./tests/test_run_formal.py --list-targets
4546
./tests/test_run_formal.py --target hru
4647
./tests/test_run_formal.py --task bmc
4748
./tests/test_run_formal.py --verbose
@@ -129,15 +130,7 @@ Yosys supports a subset of SystemVerilog Assertions. Key constraints:
129130
formal/
130131
├── README.md # This file
131132
├── .gitignore # Ignores sby working directories
132-
├── hru.sby # Hazard resolution unit
133-
├── lr_sc.sby # LR/SC reservation register
134-
├── trap_unit.sby # Trap unit
135-
├── csr_file.sby # CSR file
136-
├── fwd_unit.sby # Forwarding unit
137-
├── fp_fwd_unit.sby # FP forwarding unit
138-
├── cache_hit.sby # Cache hit detector
139-
├── cache_write.sby # Cache write controller
140-
└── data_mem_arb.sby # Data memory arbiter
133+
└── *.sby # Formal targets (one file per block)
141134
```
142135

143136
Assertions live in the RTL files themselves (inside `ifdef FORMAL` blocks), not in separate files.

hw/rtl/README.md

Lines changed: 21 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -639,123 +639,29 @@ Cycle N+1: +--------------+------------------------+
639639

640640
## Directory Structure
641641

642+
`hw/rtl/frost.f` is the source of truth for synthesis/simulation file ordering and
643+
module inclusion. This README keeps only a high-level map to avoid drift.
644+
642645
```
643646
rtl/
644-
├── frost.sv # Top-level: clocks, resets, I/O integration
645-
├── frost.f # File list for simulation/synthesis
646-
647-
├── lib/ # Generic FPGA library components
648-
│ ├── ram/
649-
│ │ ├── sdp_dist_ram.sv # Simple dual-port distributed RAM (async read)
650-
│ │ ├── mwp_dist_ram.sv # Multi-write-port distributed RAM (LVT-based)
651-
│ │ ├── sdp_block_ram.sv # Simple dual-port block RAM (sync read)
652-
│ │ ├── sdp_block_ram_dc.sv # Dual-clock block RAM (for CDC)
653-
│ │ ├── tdp_bram_dc.sv # True dual-port RAM (dual-clock, simple)
654-
│ │ └── tdp_bram_dc_byte_en.sv # True dual-port RAM (dual-clock, byte enables)
655-
│ ├── stall_capture_reg.sv # Pipeline stall capture register (generic utility)
656-
│ └── fifo/
657-
│ ├── sync_dist_ram_fifo.sv # Synchronous FIFO (distributed RAM)
658-
│ └── dc_fifo.sv # Dual-clock FIFO (binary pointers)
659-
660-
├── peripherals/ # Peripheral modules
661-
│ ├── uart_tx.sv # UART transmitter
662-
│ └── uart_rx.sv # UART receiver
663-
664-
└── cpu_and_mem/
665-
├── cpu_and_mem.sv # CPU + memory integration
666-
667-
└── cpu/
668-
├── cpu.sv # 6-stage pipeline top-level
669-
├── data_mem_arbiter.sv # Data memory interface mux (EX/AMO/FP64 arbitration)
670-
├── riscv_pkg.sv # Type definitions, opcodes, structs
671-
672-
├── if_stage/ # Instruction Fetch stage
673-
│ ├── if_stage.sv # PC management, instruction fetch
674-
│ ├── pc_controller.sv # PC update logic, branch targeting
675-
│ ├── pc_increment_calculator.sv # Sequential PC computation (parallel adders)
676-
│ ├── control_flow_tracker.sv # Holdoff signal generation
677-
│ ├── branch_prediction/ # Branch prediction subsystem
678-
│ │ ├── branch_predictor.sv # 32-entry BTB
679-
│ │ ├── branch_prediction_controller.sv # Prediction gating logic (BTB + RAS)
680-
│ │ ├── prediction_metadata_tracker.sv # Stall/spanning handling
681-
│ │ ├── ras_detector.sv # Call/return/coroutine detection
682-
│ │ └── return_address_stack.sv # 8-entry return address stack
683-
│ └── c_extension/ # Compressed instruction (C ext) support
684-
│ ├── c_ext_state.sv # C extension state machine
685-
│ ├── instruction_aligner.sv # Parcel selection, alignment
686-
│ └── rvc_decompressor.sv # 16-bit to 32-bit expansion
687-
688-
├── pd_stage/ # Pre-Decode stage
689-
│ └── pd_stage.sv # C extension decompression, early source register extraction
690-
691-
├── id_stage/ # Instruction Decode stage
692-
│ ├── id_stage.sv # ID stage integration, pipeline register
693-
│ ├── instr_decoder.sv # Opcode/funct decoder
694-
│ ├── immediate_decoder.sv # I/S/B/U/J immediate extraction
695-
│ ├── instruction_type_decoder.sv # Direct type detection (timing opt)
696-
│ └── branch_target_precompute.sv # Pre-computed targets/prediction verification
697-
698-
├── ex_stage/ # Execute stage
699-
│ ├── ex_stage.sv # EX stage integration, pipeline register
700-
│ ├── branch_jump_unit.sv # Branch condition evaluation, target calc
701-
│ ├── branch_redirect_unit.sv # Misprediction detection, BTB/RAS recovery
702-
│ ├── store_unit.sv # Store address/data preparation
703-
│ ├── exception_detector.sv # ECALL, EBREAK, misaligned access detection
704-
│ ├── alu/
705-
│ │ ├── alu.sv # Main ALU (all extensions)
706-
│ │ ├── multiplier.sv # 4-cycle DSP-tiled multiplier
707-
│ │ └── divider.sv # 17-cycle radix-2 divider (2x folded)
708-
│ ├── dsp_tiled_multiplier_unsigned.sv # Shared 27x35 tiled unsigned multiply core
709-
│ └── fpu/ # Floating-Point Unit (F/D extensions)
710-
│ ├── fpu.sv # FPU top-level, operation routing
711-
│ ├── fpu_adder_unit.sv # S+D adder wrapper (tracking FSM, NaN-boxing)
712-
│ ├── fpu_mult_unit.sv # S+D multiplier wrapper
713-
│ ├── fpu_fma_unit.sv # S+D FMA wrapper
714-
│ ├── fpu_compare_unit.sv # S+D compare/min/max wrapper
715-
│ ├── fpu_sign_inject_unit.sv # S+D sign injection wrapper
716-
│ ├── fpu_classify_unit.sv # S+D classify wrapper
717-
│ ├── fpu_div_sqrt_unit.sv # S+D divider + sqrt wrapper (shared FSM)
718-
│ ├── fpu_convert_unit.sv # S+D+SD conversion wrapper
719-
│ ├── fp_adder.sv # Addition/subtraction (4-cycle)
720-
│ ├── fp_multiplier.sv # Multiplication (multi-cycle, non-pipelined)
721-
│ ├── fp_divider.sv # Division (~32-cycle)
722-
│ ├── fp_sqrt.sv # Square root (~32-cycle)
723-
│ ├── fp_fma.sv # Fused multiply-add (multi-cycle, non-pipelined)
724-
│ ├── fp_compare.sv # Comparisons and min/max (3-cycle)
725-
│ ├── fp_convert.sv # Integer/FP conversions (3-cycle)
726-
│ ├── fp_classify.sv # FCLASS.S (1-cycle)
727-
│ ├── fp_sign_inject.sv # Sign injection (1-cycle)
728-
│ ├── fp_convert_sd.sv # Single/double conversion (5-cycle)
729-
│ ├── fp_result_assembler.sv # Rounding + overflow/underflow + result formatting (shared)
730-
│ ├── fp_lzc.sv # Leading zero counter (shared)
731-
│ ├── fp_classify_operand.sv # Operand classifier (shared)
732-
│ ├── fp_operand_unpacker.sv # Field extraction + classification (shared)
733-
│ └── fp_subnorm_shift.sv # Subnormal right-shift (shared)
734-
735-
├── ma_stage/ # Memory Access stage
736-
│ ├── ma_stage.sv # Load completion, AMO coordination
737-
│ ├── load_unit.sv # Load data extraction/extension
738-
│ ├── amo_unit.sv # Atomic memory operation state machine
739-
│ └── fp64_sequencer.sv # FP64 load/store sequencer (FLD/FSD over 32-bit bus)
740-
741-
├── wb_stage/ # Writeback stage
742-
│ └── generic_regfile.sv # Parameterized register file (int 2R/1W, FP 3R/1W)
743-
744-
├── cache/ # Cache subsystem
745-
│ ├── l0_cache.sv # Direct-mapped L0 data cache
746-
│ ├── cache_hit_detector.sv # Cache hit detection logic
747-
│ └── cache_write_controller.sv # Cache write enable and data muxing
748-
749-
├── csr/ # CSR subsystem (Zicsr + Zicntr + M-mode)
750-
│ └── csr_file.sv # CSR register file (M-mode + counters)
751-
752-
└── control/ # Pipeline control
753-
├── forwarding_unit.sv # Integer data hazard forwarding
754-
├── fp_forwarding_unit.sv # FP data hazard forwarding (F/D extensions)
755-
├── hazard_resolution_unit.sv # Stall/flush control (incl. FPU stalls)
756-
├── hru_fp_hazards.sv # FP hazard detection (submodule of HRU)
757-
├── trap_unit.sv # Interrupt/exception handling
758-
└── lr_sc_reservation.sv # A extension: LR/SC address reservation
647+
├── frost.sv # Top-level integration
648+
├── frost.f # Authoritative file list
649+
├── lib/ # Reusable RAM/FIFO/util blocks
650+
├── peripherals/ # UART and MMIO-facing blocks
651+
└── cpu_and_mem/ # CPU pipeline and memory subsystem
652+
```
653+
654+
Useful discovery commands (from repo root):
655+
656+
```bash
657+
# All RTL modules currently in-tree
658+
find hw/rtl -name '*.sv' | sort
659+
660+
# Files included for build/simulation
661+
sed -n '1,200p' hw/rtl/frost.f
662+
663+
# Tomasulo-related modules
664+
find hw/rtl/cpu_and_mem/cpu/tomasulo -name '*.sv' | sort
759665
```
760666

761667
## Module Details

0 commit comments

Comments
 (0)