Forum Discussion

Altera_Forum's avatar
Altera_Forum
Icon for Honored Contributor rankHonored Contributor
9 years ago

Module Instantiation Problem

I have two modules in separate files sub.v and test1.v as shown below. When I attempt to compile them I get the following error messages.

** Error: C:/Users/User/Documents/UCLA/Senior(2015-2016)/Summer/Verilog/Lab5/lab5.1/test1.v(7): Checker 'SUB' not found. Instantiation 's' must be of a visible checker.

** Error: C:/Users/User/Documents/UCLA/Senior(2015-2016)/Summer/Verilog/Lab5/lab5.1/test1.v(7): A begin/end block was found with an empty body. This is permitted in SystemVerilog, but not permitted in Verilog. Please look for any stray semicolons.

Both files are in the same directory and are compiled into the same work library. I tried to add a library path that pointed to the sub module in the test1 compile settings but still got no luck. Any ideas?

module TEST1;

reg [31:0] a,b,c;

initial begin

a = 12;

b = 9;

SUB s(a,b,c);

end

endmodule

module SUB(A, B, C);

input [31:0] A;

input [31:0] B;

output [31:0] C;

assign C = A - B;

endmodule

2 Replies

  • Altera_Forum's avatar
    Altera_Forum
    Icon for Honored Contributor rankHonored Contributor

    Hello,

    Instance of 'SUB' module needs to be outside initial block. Also variable c in 'TEST1' module needs to be declared as 'wire' since it is output of 'SUB' module.

    Something like,

    module TEST1;

    reg [31:0] a,b;

    wire [31:0] c;

    initial begin

    a = 12;

    b = 9;

    end

    SUB s(a,b,c);

    endmodule

    Cheers,

    Bhaumik