data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv
1: b"%Error: data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv:3: syntax error, unexpected IDENTIFIER, expecting PACKAGE-IDENTIFIER or STRING\nimport cam_types::*;\n       ^~~~~~~~~\n%Error: data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv:5: Unsupported: classes\nclass CAMModel;\n^~~~~\n%Error: data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv:6: syntax error, unexpected IDENTIFIER\n    key_t keys [camsize_p-1:0];\n    ^~~~~\n%Error: data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv:11: Unsupported: new constructor\n    function new();\n             ^~~\n%Error: data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv:19: syntax error, unexpected IDENTIFIER, expecting '(' or ';'\n    function  read_s read(input key_t key);\n                     ^~~~\n%Error: Internal Error: data/full_repos/permissive/444559342/mp1/cam/grading/cam_model.sv:5: ../V3ParseSym.h:114: Symbols suggest ending FUNC 'read_s' but parser thinks ending CLASS 'CAMModel'\nclass CAMModel;\n^~~~~\n"
function write_s write(input key_t key, input val_t val);
        write_s rv;
        rv.lru_evict = 1'b0;
        rv.index = -1;
        for (int i = 0; i < camsize_p; ++i) begin
            if (valids[i] && (keys[i] == key)) begin
                vals[i] = val;
                for (int j = 0; j < camsize_p; ++j) begin
                    if (valids[j] && (lrus[j] < lrus[i])) begin
                        lrus[j] += 1;
                    end
                end
                lrus[i] = '0;
                return rv;
            end
        end


        for (int i = 0; i < camsize_p; ++i) begin
            if (~valids[i]) begin
                vals[i] = val;
                keys[i] = key;
                for (int j = 0; j < camsize_p; ++j) begin
                    if (valids[j])
                        lrus[j] += 1;
                end
                lrus[i] = '0;
                valids[i] = '1;
                return rv;
            end
        end


        for (int i = 0; i < camsize_p; ++i) begin
            if (lrus[i] != lru_p) begin
                lrus[i] += 1;
            end
            else begin
                lrus[i] = '0;
                vals[i] = val;
                keys[i] = key;
                rv.lru_evict = 1'b1;
                rv.index = i;
            end
        end
        return rv;
    endfunction
function write_s write(input key_t key, input val_t val);

        write_s rv;
        rv.lru_evict = 1'b0;
        rv.index = -1;
        for (int i = 0; i < camsize_p; ++i) begin
            if (valids[i] && (keys[i] == key)) begin
                vals[i] = val;
                for (int j = 0; j < camsize_p; ++j) begin
                    if (valids[j] && (lrus[j] < lrus[i])) begin
                        lrus[j] += 1;
                    end
                end
                lrus[i] = '0;
                return rv;
            end
        end


        for (int i = 0; i < camsize_p; ++i) begin
            if (~valids[i]) begin
                vals[i] = val;
                keys[i] = key;
                for (int j = 0; j < camsize_p; ++j) begin
                    if (valids[j])
                        lrus[j] += 1;
                end
                lrus[i] = '0;
                valids[i] = '1;
                return rv;
            end
        end


        for (int i = 0; i < camsize_p; ++i) begin
            if (lrus[i] != lru_p) begin
                lrus[i] += 1;
            end
            else begin
                lrus[i] = '0;
                vals[i] = val;
                keys[i] = key;
                rv.lru_evict = 1'b1;
                rv.index = i;
            end
        end
        return rv;
    endfunction