feat(hw): add CAM top-level synthesis infrastructure and fix RTL synthesis compatibility

- Add hw/syn/Makefile with hier/flat/full synth targets and artifact mirroring
- Add synth_cam_top_hier.ys for hierarchy-preserving resource estimation on Xilinx 7-series
- Add synth_cam_top_flat.ys for flattened Xilinx 7-series synthesis
- Add cam-synth just target for convenient invocation
- Guard runtime assertions (NUM_ROWS/LANES checks, noise seed checks, NOISE_BITS checks)
  behind SYNTHESIS guard in cam_core_banked, cam_read_noise, cam_write_noise, and noise_mask_grouped
- Fix shadowed 'return' variable in random128 xorshift128 function
This commit is contained in:
2026-05-18 14:30:52 +08:00
parent b9b5684718
commit 706d148a0b
9 changed files with 169 additions and 1 deletions

View File

@@ -27,9 +27,11 @@ module cam_read_noise #(
logic [127:0] random_num [0:`LANES-1];
logic [(`HASH_BITS)-1:0] mask [0:`LANES-1];
`ifndef SYNTHESIS
initial begin
if (READ_NOISE_SEED == 64'd0) $fatal(1, "READ_NOISE_SEED must be nonzero");
end
`endif
generate
for (genvar lane = 0; lane < `LANES; lane++) begin : gen_lane_noise

View File

@@ -44,9 +44,11 @@ module cam_write_noise #(
.mask_o (flip_mask)
);
`ifndef SYNTHESIS
initial begin
if (WRITE_NOISE_SEED == 64'd0) $fatal(1, "WRITE_NOISE_SEED must be nonzero");
end
`endif
always_ff @(posedge clk or negedge rst_n) begin
if (!rst_n) begin

View File

@@ -17,6 +17,7 @@ module noise_mask_grouped #(
localparam int SAMPLE_RANGE = 1 << SAMPLE_BITS;
localparam int THRESHOLD = (NOISE_RATE_NUM * SAMPLE_RANGE) / NOISE_RATE_DEN;
`ifndef SYNTHESIS
initial begin
if (NOISE_BITS <= 0) $fatal(1, "NOISE_BITS must be > 0");
if (HASH_BITS % NOISE_BITS != 0) $fatal(1, "HASH_BITS must be divisible by NOISE_BITS");
@@ -25,6 +26,7 @@ module noise_mask_grouped #(
if (NOISE_RATE_DEN <= 0) $fatal(1, "NOISE_RATE_DEN must be > 0");
if (NOISE_RATE_NUM < 0 || NOISE_RATE_NUM > NOISE_RATE_DEN) $fatal(1, "NOISE_RATE_NUM out of range");
end
`endif
always_comb begin
mask_o = '0;