mirror of
https://github.com/SikongJueluo/Mini-Nav.git
synced 2026-07-13 04:25:32 +08:00
- Split cam_core into pure memory (cam_core.sv) and match engine (match_engine.sv) - Add cam_params.svh with centralized parameter definitions (NUM_ROWS, HASH_BITS, LANES, etc.) - Update cam_top.sv to use shared parameters and compose match_engine - Update Makefile to include new match_engine module and correct Verilator define syntax
55 lines
1.8 KiB
Systemverilog
55 lines
1.8 KiB
Systemverilog
//==============================================================================
|
|
// CAM Parameter Definitions
|
|
//==============================================================================
|
|
// This file defines shared compile-time parameters for the Content-Addressable
|
|
// Memory (CAM) subsystem. All `define macros use `ifndef guards to allow
|
|
// command-line override via +define+.
|
|
//
|
|
// Macros:
|
|
// NUM_ROWS — Number of rows in the CAM array
|
|
// HASH_BITS — Width of the hash value in bits
|
|
// LANES — Number of parallel comparison lanes
|
|
// ROW_BITS — Bits needed to index NUM_ROWS rows ($clog2(NUM_ROWS))
|
|
// SCORE_BITS — Bits needed to represent HASH_BITS-bit scores ($clog2(HASH_BITS+1))
|
|
//
|
|
// The TIE_BREAK_SENTINEL localparam is a bitmask with all bits set to 1'b1,
|
|
// used as the initial / tie-breaking value in the row-priority arbiter.
|
|
//==============================================================================
|
|
|
|
`ifndef CAM_PARAMS_SVH
|
|
`define CAM_PARAMS_SVH
|
|
|
|
// Number of CAM rows.
|
|
`ifndef NUM_ROWS
|
|
`define NUM_ROWS 512
|
|
`endif
|
|
|
|
// Width of the hash value stored per row.
|
|
`ifndef HASH_BITS
|
|
`define HASH_BITS 512
|
|
`endif
|
|
|
|
// Number of parallel comparison lanes.
|
|
`ifndef LANES
|
|
`define LANES 16
|
|
`endif
|
|
|
|
// Bits required to represent a row index.
|
|
`ifndef ROW_BITS
|
|
`define ROW_BITS $clog2(`NUM_ROWS)
|
|
`endif
|
|
|
|
// Bits required to represent a full-score count.
|
|
`ifndef SCORE_BITS
|
|
`define SCORE_BITS $clog2(`HASH_BITS + 1)
|
|
`endif
|
|
|
|
// Tie-break sentinel: all ones in the row-index width.
|
|
// Used as the initial best-index value before any match is found.
|
|
localparam logic [(`ROW_BITS)-1:0] TIE_BREAK_SENTINEL = {(`ROW_BITS){1'b1}};
|
|
|
|
// Current fixed parameters require NUM_ROWS divisible by LANES.
|
|
// Non-divisible tail-group valid-mask is not implemented in this round.
|
|
|
|
`endif // CAM_PARAMS_SVH
|