data/full_repos/permissive/444559342/mp1/cam/hdl/cam_datapath.sv
1: b'%Error: data/full_repos/permissive/444559342/mp1/cam/hdl/cam_datapath.sv:3: syntax error, unexpected IDENTIFIER, expecting PACKAGE-IDENTIFIER or STRING\nimport cam_types::*;\n       ^~~~~~~~~\n%Error: Exiting due to 1 error(s)\n'
module cam_datapath
(
    input clk_i,
    input reset_n_i,
    input val_t val_i,
    input key_t key_i,
    output val_t val_o,
    CAMCtls.Datapath ctls
);


key_t keys_r [camsize_p-1:0];
val_t vals_r [camsize_p-1:0];
idx_t lrus_r [camsize_p-1:0];
camvec_t valids_r;
genvar i;



assign ctls.valids_d_c = valids_r;
assign ctls.lrus_d_c = lrus_r;
assign val_o = vals_r[ctls.read_idx_c_d];










generate
    for (i = 0; i < camsize_p; ++i) begin : hit_detector
        assign ctls.hits_d_c[i] = valids_r[i] & (keys_r[i] == key_i);
    end
endgenerate



always_ff @(posedge clk_i) begin
    if (~reset_n_i) begin
        valids_r <= '0;
        for (int i = 0; i < camsize_p; ++i) begin
            lrus_r[i] <= i;
        end
    end
    else begin
        for (int i = 0; i < camsize_p; ++i) begin
            unique case ({

                ctls.write_c_d[i],
                ctls.read_c_d[i],
                ctls.increment_lru_c_d[i]
            })
                3'b000: ;
                3'b001: lrus_r[i] <= lrus_r[i] + 1'b1;
                3'b010: lrus_r[i] <= mru_p;
                3'b100: begin
                    lrus_r[i] <= mru_p;
                    keys_r[i] <= key_i;
                    vals_r[i] <= val_i;
                    valids_r[i] <= '1;
                end
            endcase
        end
    end
end


endmodule
module cam_datapath
(
    input clk_i,
    input reset_n_i,
    input val_t val_i,
    input key_t key_i,
    output val_t val_o,
    CAMCtls.Datapath ctls
);



key_t keys_r [camsize_p-1:0];
val_t vals_r [camsize_p-1:0];
idx_t lrus_r [camsize_p-1:0];
camvec_t valids_r;
genvar i;



assign ctls.valids_d_c = valids_r;
assign ctls.lrus_d_c = lrus_r;
assign val_o = vals_r[ctls.read_idx_c_d];










generate
    for (i = 0; i < camsize_p; ++i) begin : hit_detector
        assign ctls.hits_d_c[i] = valids_r[i] & (keys_r[i] == key_i);
    end
endgenerate



always_ff @(posedge clk_i) begin
    if (~reset_n_i) begin
        valids_r <= '0;
        for (int i = 0; i < camsize_p; ++i) begin
            lrus_r[i] <= i;
        end
    end
    else begin
        for (int i = 0; i < camsize_p; ++i) begin
            unique case ({

                ctls.write_c_d[i],
                ctls.read_c_d[i],
                ctls.increment_lru_c_d[i]
            })
                3'b000: ;
                3'b001: lrus_r[i] <= lrus_r[i] + 1'b1;
                3'b010: lrus_r[i] <= mru_p;
                3'b100: begin
                    lrus_r[i] <= mru_p;
                    keys_r[i] <= key_i;
                    vals_r[i] <= val_i;
                    valids_r[i] <= '1;
                end
            endcase
        end
    end
end


endmodule