Results 1 to 4 of 4

Thread: Instantiation Errors

  1. #1
    Join Date
    Dec 2017
    Posts
    1
    Rep Power
    1

    Default Instantiation Errors

    Hello,

    I'm trying to reference my full adder module inside another module but seem to be getting lost somehow in the referencing. I keep getting the error Checker 'Full_Adder' not found. Instantiation 's' must be of a visible checker.

    the code I have is:

    always @(posedge clk)


    begin
    if (reset==1) // reset isn't pressed
    begin
    if (enable==1) //enable is active
    begin
    case ({ALU_OP})
    2'h0 : D = A & B;
    2'h1 : D = A | B;
    2'h2 : Full_Adder f(A,B,D,C);
    2'h3 : D = A * B;
    endcase
    end
    end
    end




    endmodule

    module Full_adder(a,b,answer,carry_out);
    //inputs
    input [2:0] a,b;
    //outputs
    output [2:0] answer;
    output carry_out;
    //wires
    wire carry_out;
    wire [2:0] carry;
    genvar i;
    generate
    for(i=0;i<2;i=i+1)
    begin: generate_N_bit_Adder
    if(i==0)
    half_adder f(a[0],b[0],answer[0],carry[0]);
    else
    full_adder f(a[i],b[i],carry[i-1],answer[i],carry[i]);
    end
    assign carry_out = carry[2];
    endgenerate

    endmodule

  2. #2
    Tricky is offline Moderator **Forum Master**
    Join Date
    Oct 2008
    Posts
    5,825
    Rep Power
    1

    Default Re: Instantiation Errors

    A module is not like a C function, it is like a chip on a circuit board, so it cannot be "called" inside sequential code. You must instantiate it on its own in parallel to your always block, and then use the sequential code to control the signals connected to it.

  3. #3
    Join Date
    Nov 2017
    Posts
    105
    Rep Power
    1

    Default Re: Instantiation Errors

    Hi,

    Take care on suggested point about instantiation.
    Code:
    half_adder f(a[0],b[0],answer[0],carry[0]);
    full_adder f(a[1],b[1],carry[0],answer[1],carry[1]);
    full_adder f(a[2],b[2],carry[1],answer[2],carry[2]);
    etc.

    Best Regards,
    Anand Raj Shankar
    (This message was posted on behalf of Intel Corporation)

  4. #4
    Join Date
    Jun 2007
    Location
    The Net!
    Posts
    121
    Rep Power
    1

    Default Re: Instantiation Errors

    Hi,

    The issue is the module names. Verilog is case sensitive. In the module you've used "Full_adder" and in the instantiation you've used "Full_Adder" . The tool will think this "Full_Adder " is another module. Just be careful about the module names.

    Plus as pointed out earlier, instances are not like C functions. Use named instances instead of positional as this will reduce the chances of errors.

Similar Threads

  1. module instantiation
    By muzammil007 in forum Verilog and System Verilog
    Replies: 5
    Last Post: July 22nd, 2013, 06:56 PM
  2. Forced LE instantiation
    By petter.kallstrom in forum General Altera Discussion
    Replies: 0
    Last Post: June 18th, 2010, 02:22 PM
  3. IP core instantiation
    By wpz in forum IP Discussion
    Replies: 2
    Last Post: February 1st, 2010, 03:20 AM
  4. A question about GXB instantiation
    By Jerry in forum Quartus II and EDA Tools Discussion
    Replies: 1
    Last Post: November 15th, 2009, 07:07 PM
  5. Instantiation of DMA on SOPC Builder
    By LETS in forum General Altera Discussion
    Replies: 5
    Last Post: September 1st, 2009, 09:12 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •