data/full_repos/permissive/434840709/lab3/3.2/DataRead.v
1: b'%Warning-WIDTH: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:43: Operator SHIFTL expects 32 bits on the LHS, but LHS\'s CONST \'4\'h1\' generates 4 bits.\n                                                                           : ... In instance DataReadService\n                     msgArray = msgArray + (4\'b0001 << (4*cursor)); \n                                                    ^~\n                ... Use "/* verilator lint_off WIDTH */" and lint_on around source to disable this message.\n%Warning-WIDTH: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:45: Operator SHIFTL expects 32 bits on the LHS, but LHS\'s CONST \'4\'ha\' generates 4 bits.\n                                                                           : ... In instance DataReadService\n                       msgArray = msgArray - (4\'b1010 << (4*cursor));\n                                                      ^~\n%Warning-WIDTH: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:44: Operator AND expects 32 bits on the RHS, but RHS\'s CONST \'4\'hf\' generates 4 bits.\n                                                                           : ... In instance DataReadService\n                 if (((msgArray >> (4*cursor)) & 4\'b1111) == 10)  \n                                               ^\n%Warning-WIDTH: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:49: Operator SHIFTL expects 32 bits on the LHS, but LHS\'s CONST \'4\'h9\' generates 4 bits.\n                                                                           : ... In instance DataReadService\n                       msgArray = msgArray + (4\'b1001 << (4*cursor));\n                                                      ^~\n%Warning-WIDTH: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:50: Operator SHIFTL expects 32 bits on the LHS, but LHS\'s CONST \'4\'h1\' generates 4 bits.\n                                                                           : ... In instance DataReadService\n                 else  msgArray = msgArray - (4\'b0001 << (4*cursor)); \n                                                      ^~\n%Warning-WIDTH: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:48: Operator AND expects 32 bits on the RHS, but RHS\'s CONST \'4\'hf\' generates 4 bits.\n                                                                           : ... In instance DataReadService\n                 if (((msgArray >> (4*cursor)) & 4\'b1111) == 0)  \n                                               ^\n%Error: data/full_repos/permissive/434840709/lab3/3.2/DataRead.v:62: Cannot find file containing module: \'InputShowDriver\'\n    InputShowDriver u(clk190hz, rst,sel, dataBus, cursor[1:0], pos, seg);\n    ^~~~~~~~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/434840709/lab3/3.2,data/full_repos/permissive/434840709/InputShowDriver\n             data/full_repos/permissive/434840709/lab3/3.2,data/full_repos/permissive/434840709/InputShowDriver.v\n             data/full_repos/permissive/434840709/lab3/3.2,data/full_repos/permissive/434840709/InputShowDriver.sv\n             InputShowDriver\n             InputShowDriver.v\n             InputShowDriver.sv\n             obj_dir/InputShowDriver\n             obj_dir/InputShowDriver.v\n             obj_dir/InputShowDriver.sv\n%Error: Exiting due to 1 error(s), 6 warning(s)\n'
module DataReadService(
                input clk190hz,
                input rst,
                input sel,
                input leftMove,
                input rightMove,
                input inc,
                input dec,
                output [3:0] pos,
                output [7:0] seg,
                output [31:0] myID
                );
    
    reg [31:0] msgArray = 0;
    reg [2:0]  cursor   = 7;
    reg [15:0] dataBus;
    reg LeftMoveDelay   = 0;
    reg RightMoveDelay  = 0;
    reg IncreaseDelay   = 0;
    reg DecreaseDelay   = 0;
    assign myID = msgArray;
    
    always @(posedge clk190hz)
    begin
        if (!rst) begin
            msgArray  = 0;
            cursor    = 7;
            LeftMoveDelay  = 0;
            RightMoveDelay = 0;
            IncreaseDelay  = 0;
            DecreaseDelay  = 0;
        end
        else begin
            if (leftMove == 1 && LeftMoveDelay == 0) begin
                cursor = cursor + 1;
            end
            else if (rightMove == 1 && RightMoveDelay == 0) begin 
                     cursor = cursor - 1;
            end
            else if (inc == 1 && IncreaseDelay == 0) begin
                     msgArray = msgArray + (4'b0001 << (4*cursor));
                 if (((msgArray >> (4*cursor)) & 4'b1111) == 10)
                       msgArray = msgArray - (4'b1010 << (4*cursor));
            end
            else if (dec == 1 && DecreaseDelay == 0) begin
                 if (((msgArray >> (4*cursor)) & 4'b1111) == 0)
                       msgArray = msgArray + (4'b1001 << (4*cursor));
                 else  msgArray = msgArray - (4'b0001 << (4*cursor));
            end

            LeftMoveDelay  = leftMove;
            RightMoveDelay = rightMove;
            IncreaseDelay  = inc;
            DecreaseDelay  = dec;
        end
         
        if (cursor<4) dataBus = msgArray[15:0];
        else dataBus = msgArray[31:16];
    end
    InputShowDriver u(clk190hz, rst,sel, dataBus, cursor[1:0], pos, seg);
endmodule
module DataReadService(
                input clk190hz,
                input rst,
                input sel,
                input leftMove,
                input rightMove,
                input inc,
                input dec,
                output [3:0] pos,
                output [7:0] seg,
                output [31:0] myID
                );

    
    reg [31:0] msgArray = 0;
    reg [2:0]  cursor   = 7;
    reg [15:0] dataBus;
    reg LeftMoveDelay   = 0;
    reg RightMoveDelay  = 0;
    reg IncreaseDelay   = 0;
    reg DecreaseDelay   = 0;
    assign myID = msgArray;
    
    always @(posedge clk190hz)
    begin
        if (!rst) begin
            msgArray  = 0;
            cursor    = 7;
            LeftMoveDelay  = 0;
            RightMoveDelay = 0;
            IncreaseDelay  = 0;
            DecreaseDelay  = 0;
        end
        else begin
            if (leftMove == 1 && LeftMoveDelay == 0) begin
                cursor = cursor + 1;
            end
            else if (rightMove == 1 && RightMoveDelay == 0) begin 
                     cursor = cursor - 1;
            end
            else if (inc == 1 && IncreaseDelay == 0) begin
                     msgArray = msgArray + (4'b0001 << (4*cursor));
                 if (((msgArray >> (4*cursor)) & 4'b1111) == 10)
                       msgArray = msgArray - (4'b1010 << (4*cursor));
            end
            else if (dec == 1 && DecreaseDelay == 0) begin
                 if (((msgArray >> (4*cursor)) & 4'b1111) == 0)
                       msgArray = msgArray + (4'b1001 << (4*cursor));
                 else  msgArray = msgArray - (4'b0001 << (4*cursor));
            end

            LeftMoveDelay  = leftMove;
            RightMoveDelay = rightMove;
            IncreaseDelay  = inc;
            DecreaseDelay  = dec;
        end
         
        if (cursor<4) dataBus = msgArray[15:0];
        else dataBus = msgArray[31:16];
    end
    InputShowDriver u(clk190hz, rst,sel, dataBus, cursor[1:0], pos, seg);
endmodule