data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new/PieceWiseLinearApproximation.v
1: b"%Error: data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new/PieceWiseLinearApproximation.v:29: Cannot find file containing module: 'SegmentDecoder'\n    SegmentDecoder #(.WL(16),.WA(6)) decode (.x(x),.address(address));\n    ^~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new,data/full_repos/permissive/482974241/SegmentDecoder\n             data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new,data/full_repos/permissive/482974241/SegmentDecoder.v\n             data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new,data/full_repos/permissive/482974241/SegmentDecoder.sv\n             SegmentDecoder\n             SegmentDecoder.v\n             SegmentDecoder.sv\n             obj_dir/SegmentDecoder\n             obj_dir/SegmentDecoder.v\n             obj_dir/SegmentDecoder.sv\n%Error: data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new/PieceWiseLinearApproximation.v:30: Cannot find file containing module: 'LUT'\n    LUT #(.WL(32),.WA(6)) lut (.address(address),.segmentCoeff({a,b}));\n    ^~~\n%Error: data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new/PieceWiseLinearApproximation.v:31: Cannot find file containing module: 'FixedPointMult'\n    FixedPointMult #(.WI1(4),.WF1(12),.WI2(4),.WF2(12),.WIO(8),.WFO(24)) mult (.in1(x),.in2(a),.out(ax));\n    ^~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/482974241/CosineFunctionApproximation.srcs/sources_1/new/PieceWiseLinearApproximation.v:32: Cannot find file containing module: 'FixedPointAdder'\n    FixedPointAdder #(.WI1(8),.WF1(24),.WI2(4),.WF2(12),.WIO(2),.WFO(14)) add (.in1(ax),.in2(b),.out(cosine));\n    ^~~~~~~~~~~~~~~\n%Error: Exiting due to 4 error(s)\n"
module PieceWiseLinearApproximation #(parameter WL = 16, WA = 6, WO = 16)(
        input signed [WL-1:0] x,
        output signed [WO-1:0] cosine
    );
    wire signed [WL-1:0] a, b;
    wire signed [(WL+WL)-1:0] ax;
    wire [WA-1:0] address;
    
    SegmentDecoder #(.WL(16),.WA(6)) decode (.x(x),.address(address));
    LUT #(.WL(32),.WA(6)) lut (.address(address),.segmentCoeff({a,b}));
    FixedPointMult #(.WI1(4),.WF1(12),.WI2(4),.WF2(12),.WIO(8),.WFO(24)) mult (.in1(x),.in2(a),.out(ax));
    FixedPointAdder #(.WI1(8),.WF1(24),.WI2(4),.WF2(12),.WIO(2),.WFO(14)) add (.in1(ax),.in2(b),.out(cosine));
endmodule
module PieceWiseLinearApproximation #(parameter WL = 16, WA = 6, WO = 16)(
        input signed [WL-1:0] x,
        output signed [WO-1:0] cosine
    );

    wire signed [WL-1:0] a, b;
    wire signed [(WL+WL)-1:0] ax;
    wire [WA-1:0] address;
    
    SegmentDecoder #(.WL(16),.WA(6)) decode (.x(x),.address(address));
    LUT #(.WL(32),.WA(6)) lut (.address(address),.segmentCoeff({a,b}));
    FixedPointMult #(.WI1(4),.WF1(12),.WI2(4),.WF2(12),.WIO(8),.WFO(24)) mult (.in1(x),.in2(a),.out(ax));
    FixedPointAdder #(.WI1(8),.WF1(24),.WI2(4),.WF2(12),.WIO(2),.WFO(14)) add (.in1(ax),.in2(b),.out(cosine));
endmodule