data/full_repos/permissive/420259327/IP/autotake.v
1: b"%Error: data/full_repos/permissive/420259327/IP/autotake.v:51: Cannot find file containing module: 'clock_div'\n    clock_div clockDelay(\n    ^~~~~~~~~\n        ... Looked in:\n             data/full_repos/permissive/420259327/IP,data/full_repos/permissive/420259327/clock_div\n             data/full_repos/permissive/420259327/IP,data/full_repos/permissive/420259327/clock_div.v\n             data/full_repos/permissive/420259327/IP,data/full_repos/permissive/420259327/clock_div.sv\n             clock_div\n             clock_div.v\n             clock_div.sv\n             obj_dir/clock_div\n             obj_dir/clock_div.v\n             obj_dir/clock_div.sv\n%Error: data/full_repos/permissive/420259327/IP/autotake.v:57: Cannot find file containing module: 'interp_10bit'\n    interp_10bit interpTbar(\n    ^~~~~~~~~~~~\n%Error: Exiting due to 2 error(s)\n"
module autotake(

    input clk,
    
    input trigA,
    input trigB,
    input rst,
    input [2:0] speed,
    
    input [9:0] tbar,
    
    output autoFadeDone,
    output [9:0] mix_val,
    output fadeclk,
    output [1:0] state
    );
    
    reg [9:0] tbarTemp;
    reg [9:0] tbarVirtual;
    wire [9:0] tbarVertualWire;
    reg [9:0] fadeTo;
    reg dir ;
    reg [9:0] stepCounter;
    reg autoDoneFlag;
    reg autoTakeActive;
    wire [9:0] mix_out;
    wire [7:0] fade_clk;
    
    clock_div clockDelay(
        .clk(clk),
        .rst(rst),
        .Q(fade_clk)
    );
    
    interp_10bit interpTbar(
        .clk1x(clk),
        .strm0(fadeTo),
        .strm1(tbarVertualWire),
        .alpha_strm(stepCounter),
        .blnd(mix_out)
    
    );
    assign state = State;
    assign fadeclk = stepCounter[3];

    assign tbarVertualWire = tbarVirtual;
    assign autoFadeDone = autoDoneFlag;
    assign mix_val = mix_out;
    
    

    reg [1:0]State;
    localparam Start = 2'b00;
    localparam Idle = 2'b01;
    localparam Work = 2'b11;
    localparam Done = 2'b10;
    
    reg tReset;
    
    always @(posedge clk) begin
        tReset <= rst;
        if(tReset) begin
            
            State <= Start;
        end else begin
        
        case(State)
                    Start: begin                     
                        State <= Idle;
                    end
                    Idle: begin
                     if(trigA | trigB)
                        begin 
                            State <= Work;
                           
                        end
                        
                     if(trigA & !trigB)
                        begin 
                            dir <= 1'b0;
                        end
                        
                     if(!trigA & trigB)
                        begin 
                            dir <= 1'b1;
                        end
                        
                    end
                    Work: begin
                           if(autoTakeActive == 1'b0)
                            begin
                                State <= Done;
                            end else if(tbarValChange & (trigA == 0) & (trigB == 0))
                            begin
                                State <= Done;
                                
                            end
                            
                            
                    end
                    Done: begin                   
                        State <= Idle;
                    end
                    default:;
                endcase
            end
        end
        
        
        always @ (clk) begin

        if(State == Start)
            begin
                stepCounter <= 10'b0;
                autoTakeActive <= 1'b0;
                autoDoneFlag <= 1'b0;
                tbarVirtual <= tbar;
            end
            
        if(State == Idle)
                autoTakeActive <= 1'b0;
                
                begin
                if (dir == 1'b0) begin
                    fadeTo <= 10'd0;
                end else if
                 (dir == 1'b1) begin
                    fadeTo <= 10'd1023;
                end
                
                if(autoDoneFlag)
                begin
                    tbarVirtual <= mix_out;
                    autoDoneFlag <= 1'b0;
                end
                
               if(tbarValChange & !trigA & !trigB)
               begin
                    tbarVirtual <= tbar;
               end
                
               
        end
        
        if(State == Work)
        begin
        
               if(tbarValChange & !trigA & !trigB)
                begin
                    tbarVirtual <= tbar;
                    autoTakeActive <= 1'b0;
                    autoDoneFlag <= 1'b1;
                end
        
         if( stepCounter == 10'd1023 ) begin
            autoTakeActive <= 1'b0;
            autoDoneFlag <= 1'b1;
         end 
         else begin
                    if(fadeClkTrig )
                    begin
                        stepCounter <= stepCounter + 1; 
                    end
                    autoDoneFlag <= 1'b0;
                    autoTakeActive <= 1'b1;
                end
        end
        
        if(State == Done) 
        begin
            stepCounter <= 10'b0;
            autoTakeActive <= 1'b0;
            autoDoneFlag <= 1'b0;
        end
                    
                
        end
    
        always @ (posedge clk) begin 
            i_fadeTrig <= fade_clk[speed];
            o_fadeTrig <= i_fadeTrig;
            tbarTemp <= tbar;
            
            if(tbarTemp != tbar)
                begin
                    tbarValChange = 1'b1;
                end
            else
                begin
                    tbarValChange = 1'b0;
                end
        end
        
        wire fadeClkTrig;
        reg o_fadeTrig;
        reg i_fadeTrig;
        assign fadeClkTrig = (~o_fadeTrig & i_fadeTrig);
        
        reg tbarValChange;
        

         
    
endmodule
module autotake(

    input clk,
    
    input trigA,
    input trigB,
    input rst,
    input [2:0] speed,
    
    input [9:0] tbar,
    
    output autoFadeDone,
    output [9:0] mix_val,
    output fadeclk,
    output [1:0] state
    );

    
    reg [9:0] tbarTemp;
    reg [9:0] tbarVirtual;
    wire [9:0] tbarVertualWire;
    reg [9:0] fadeTo;
    reg dir ;
    reg [9:0] stepCounter;
    reg autoDoneFlag;
    reg autoTakeActive;
    wire [9:0] mix_out;
    wire [7:0] fade_clk;
    
    clock_div clockDelay(
        .clk(clk),
        .rst(rst),
        .Q(fade_clk)
    );
    
    interp_10bit interpTbar(
        .clk1x(clk),
        .strm0(fadeTo),
        .strm1(tbarVertualWire),
        .alpha_strm(stepCounter),
        .blnd(mix_out)
    
    );
    assign state = State;
    assign fadeclk = stepCounter[3];

    assign tbarVertualWire = tbarVirtual;
    assign autoFadeDone = autoDoneFlag;
    assign mix_val = mix_out;
    
    

    reg [1:0]State;
    localparam Start = 2'b00;
    localparam Idle = 2'b01;
    localparam Work = 2'b11;
    localparam Done = 2'b10;
    
    reg tReset;
    
    always @(posedge clk) begin
        tReset <= rst;
        if(tReset) begin
            
            State <= Start;
        end else begin
        
        case(State)
                    Start: begin                     
                        State <= Idle;
                    end
                    Idle: begin
                     if(trigA | trigB)
                        begin 
                            State <= Work;
                           
                        end
                        
                     if(trigA & !trigB)
                        begin 
                            dir <= 1'b0;
                        end
                        
                     if(!trigA & trigB)
                        begin 
                            dir <= 1'b1;
                        end
                        
                    end
                    Work: begin
                           if(autoTakeActive == 1'b0)
                            begin
                                State <= Done;
                            end else if(tbarValChange & (trigA == 0) & (trigB == 0))
                            begin
                                State <= Done;
                                
                            end
                            
                            
                    end
                    Done: begin                   
                        State <= Idle;
                    end
                    default:;
                endcase
            end
        end
        
        
        always @ (clk) begin

        if(State == Start)
            begin
                stepCounter <= 10'b0;
                autoTakeActive <= 1'b0;
                autoDoneFlag <= 1'b0;
                tbarVirtual <= tbar;
            end
            
        if(State == Idle)
                autoTakeActive <= 1'b0;
                
                begin
                if (dir == 1'b0) begin
                    fadeTo <= 10'd0;
                end else if
                 (dir == 1'b1) begin
                    fadeTo <= 10'd1023;
                end
                
                if(autoDoneFlag)
                begin
                    tbarVirtual <= mix_out;
                    autoDoneFlag <= 1'b0;
                end
                
               if(tbarValChange & !trigA & !trigB)
               begin
                    tbarVirtual <= tbar;
               end
                
               
        end
        
        if(State == Work)
        begin
        
               if(tbarValChange & !trigA & !trigB)
                begin
                    tbarVirtual <= tbar;
                    autoTakeActive <= 1'b0;
                    autoDoneFlag <= 1'b1;
                end
        
         if( stepCounter == 10'd1023 ) begin
            autoTakeActive <= 1'b0;
            autoDoneFlag <= 1'b1;
         end 
         else begin
                    if(fadeClkTrig )
                    begin
                        stepCounter <= stepCounter + 1; 
                    end
                    autoDoneFlag <= 1'b0;
                    autoTakeActive <= 1'b1;
                end
        end
        
        if(State == Done) 
        begin
            stepCounter <= 10'b0;
            autoTakeActive <= 1'b0;
            autoDoneFlag <= 1'b0;
        end
                    
                
        end
    
        always @ (posedge clk) begin 
            i_fadeTrig <= fade_clk[speed];
            o_fadeTrig <= i_fadeTrig;
            tbarTemp <= tbar;
            
            if(tbarTemp != tbar)
                begin
                    tbarValChange = 1'b1;
                end
            else
                begin
                    tbarValChange = 1'b0;
                end
        end
        
        wire fadeClkTrig;
        reg o_fadeTrig;
        reg i_fadeTrig;
        assign fadeClkTrig = (~o_fadeTrig & i_fadeTrig);
        
        reg tbarValChange;
        

         
    
endmodule