data/full_repos/permissive/205673649/MIPS/Source/tl_instruction_fetch.v
1: b"%Error: data/full_repos/permissive/205673649/MIPS/Source/tl_instruction_fetch.v:100: Cannot find file containing module: 'mux_pc'\n mux_pc\n ^~~~~~\n        ... Looked in:\n             data/full_repos/permissive/205673649/MIPS/Source,data/full_repos/permissive/205673649/mux_pc\n             data/full_repos/permissive/205673649/MIPS/Source,data/full_repos/permissive/205673649/mux_pc.v\n             data/full_repos/permissive/205673649/MIPS/Source,data/full_repos/permissive/205673649/mux_pc.sv\n             mux_pc\n             mux_pc.v\n             mux_pc.sv\n             obj_dir/mux_pc\n             obj_dir/mux_pc.v\n             obj_dir/mux_pc.sv\n%Error: data/full_repos/permissive/205673649/MIPS/Source/tl_instruction_fetch.v:114: Cannot find file containing module: 'pc'\n pc\n ^~\n%Error: data/full_repos/permissive/205673649/MIPS/Source/tl_instruction_fetch.v:128: Cannot find file containing module: 'ram_instrucciones'\n ram_instrucciones\n ^~~~~~~~~~~~~~~~~\n%Error: data/full_repos/permissive/205673649/MIPS/Source/tl_instruction_fetch.v:149: Cannot find file containing module: 'adder_fetch'\n adder_fetch \n ^~~~~~~~~~~\n%Error: Exiting due to 4 error(s)\n"
module tl_instruction_fetch 
    #(
        parameter LEN = 32,
        parameter INIT_FILE_IM="/home/andres/Facultad/Arquitectura_de_Computadoras/Andres/Arqui/MIPS/Source/instruction_memory.txt"
    )
    (
        input i_clk,
        input i_rst,
        input [LEN-1:0] i_branch_dir,
        input i_PCSrc,
        input i_flag_stall,
        input i_flag_jump,
        input [LEN-1:0] i_dir_jump,
        input [LEN-1:0] i_dir_mem_instr,
        input i_wea_mem_instr,
        input [LEN-1:0] i_addr_mem_inst,
        output reg [LEN-1:0] o_instruccion,
        output reg [LEN-1:0] o_adder,
        output reg [LEN-1:0] o_contador_programa,
        output o_flag_halt
    );
    

    wire [LEN-1:0] contador_programa;
    

    wire [LEN-1:0] mux_pc;
    

    wire [LEN-1:0] adder;
   

    wire [LEN-1:0] instruccion;
    wire rsta_mem;
    wire regcea_mem;
   
    wire flush; 

    assign rsta_mem =0;
    assign regcea_mem=1;
    
    assign flush = i_PCSrc | i_flag_jump;
    
 always @(negedge i_clk)
 begin
    if(!i_rst)
    begin
        o_adder <= 32'b0;
        o_instruccion <= 32'b0;
        o_contador_programa <= 32'h0;
    end
    else
    begin
        if(flush)
        begin
            o_adder <= 32'b0;
            o_instruccion <= 32'b0;
        end
        else
        begin
            if(i_flag_stall==1'b1)
            begin
                o_adder <= o_adder;
                o_instruccion <= o_instruccion;
                o_contador_programa <= o_contador_programa;
            end
            else
            begin
                o_adder <= adder;
                o_instruccion <= instruccion;
                o_contador_programa <= contador_programa;
            end
        end
    end
 end
 

 mux_pc
 #(
    .LEN(LEN)
  )
  u_mux
  (
    .i_pc(adder),
    .i_jump(i_dir_jump),  
    .i_branch(i_branch_dir),
    .i_selector({i_flag_jump,i_PCSrc}),  
    .o_mux(mux_pc)
  );
 

 pc
 #(
    .LEN(LEN)
  )
  u_pc
  (
    .i_clk(i_clk),
    .i_rst(i_rst),
    .i_mux(mux_pc),
    .i_enable(i_flag_stall),
    .o_pc(contador_programa)
  );
  

 ram_instrucciones
 #(
    .RAM_WIDTH(LEN),
    .RAM_DEPTH(2048),
    .RAM_PERFORMANCE("LOW_LATENCY"),
    .INIT_FILE(INIT_FILE_IM)        
 )
 u_ram_instrucciones
 (
  .i_addra((!i_rst)? i_addr_mem_inst: contador_programa),
  .i_dina(i_dir_mem_instr), 
  .i_clka(i_clk),
  .i_wea(i_wea_mem_instr),  
  .i_ena(!i_flag_stall),
  .i_rsta(rsta_mem),
  .i_regcea(regcea_mem), 
  .o_douta(instruccion),
  .o_halt(o_flag_halt)  
 );
 

 adder_fetch 
 #(
    .LEN(LEN)
  )
  u_adder_fetch
  (
    .i_a(contador_programa), 
    .i_b(32'h00000001),
    .i_enable(!o_flag_halt),
    .o_adder(adder) 
  );
    
    
endmodule
module tl_instruction_fetch 
    #(
        parameter LEN = 32,
        parameter INIT_FILE_IM="/home/andres/Facultad/Arquitectura_de_Computadoras/Andres/Arqui/MIPS/Source/instruction_memory.txt"
    )
    (
        input i_clk,
        input i_rst,
        input [LEN-1:0] i_branch_dir,
        input i_PCSrc,
        input i_flag_stall,
        input i_flag_jump,
        input [LEN-1:0] i_dir_jump,
        input [LEN-1:0] i_dir_mem_instr,
        input i_wea_mem_instr,
        input [LEN-1:0] i_addr_mem_inst,
        output reg [LEN-1:0] o_instruccion,
        output reg [LEN-1:0] o_adder,
        output reg [LEN-1:0] o_contador_programa,
        output o_flag_halt
    );

    

    wire [LEN-1:0] contador_programa;
    

    wire [LEN-1:0] mux_pc;
    

    wire [LEN-1:0] adder;
   

    wire [LEN-1:0] instruccion;
    wire rsta_mem;
    wire regcea_mem;
   
    wire flush; 

    assign rsta_mem =0;
    assign regcea_mem=1;
    
    assign flush = i_PCSrc | i_flag_jump;
    
 always @(negedge i_clk)
 begin
    if(!i_rst)
    begin
        o_adder <= 32'b0;
        o_instruccion <= 32'b0;
        o_contador_programa <= 32'h0;
    end
    else
    begin
        if(flush)
        begin
            o_adder <= 32'b0;
            o_instruccion <= 32'b0;
        end
        else
        begin
            if(i_flag_stall==1'b1)
            begin
                o_adder <= o_adder;
                o_instruccion <= o_instruccion;
                o_contador_programa <= o_contador_programa;
            end
            else
            begin
                o_adder <= adder;
                o_instruccion <= instruccion;
                o_contador_programa <= contador_programa;
            end
        end
    end
 end
 

 mux_pc
 #(
    .LEN(LEN)
  )
  u_mux
  (
    .i_pc(adder),
    .i_jump(i_dir_jump),  
    .i_branch(i_branch_dir),
    .i_selector({i_flag_jump,i_PCSrc}),  
    .o_mux(mux_pc)
  );
 

 pc
 #(
    .LEN(LEN)
  )
  u_pc
  (
    .i_clk(i_clk),
    .i_rst(i_rst),
    .i_mux(mux_pc),
    .i_enable(i_flag_stall),
    .o_pc(contador_programa)
  );
  

 ram_instrucciones
 #(
    .RAM_WIDTH(LEN),
    .RAM_DEPTH(2048),
    .RAM_PERFORMANCE("LOW_LATENCY"),
    .INIT_FILE(INIT_FILE_IM)        
 )
 u_ram_instrucciones
 (
  .i_addra((!i_rst)? i_addr_mem_inst: contador_programa),
  .i_dina(i_dir_mem_instr), 
  .i_clka(i_clk),
  .i_wea(i_wea_mem_instr),  
  .i_ena(!i_flag_stall),
  .i_rsta(rsta_mem),
  .i_regcea(regcea_mem), 
  .o_douta(instruccion),
  .o_halt(o_flag_halt)  
 );
 

 adder_fetch 
 #(
    .LEN(LEN)
  )
  u_adder_fetch
  (
    .i_a(contador_programa), 
    .i_b(32'h00000001),
    .i_enable(!o_flag_halt),
    .o_adder(adder) 
  );
    
    
endmodule