Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Assuming recursive instantiation. Modelsim

Status
Not open for further replies.

jiraiya

Newbie level 1
Joined
Feb 12, 2015
Messages
1
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
13
I am new to verilog.

I wrote this small code where i am calling the add function in counter program. I get the following error when i try to simulate it-

# Region: /tb/DUT/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1
# ** Error: (vsim-3036) Instantiation depth of '/tb/DUT/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1/u1' is 76. Assuming recursive instantiation.


Code Verilog - [expand]
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
add.v - 
module add (a,b,c);
    input a,b;
    output c
    assign c=a+b;
endmodule
 
counter.v -
module counter (a,b,c,d,e,f);
    input a,b,d,e;
    output c,f;
    
    add u1 (a,b,c);
    add u2 (d,e,f);
endmodule
 
counter_tb.v-
module tb;
    reg a,b,d,e;    
    wire c,f;   
 
    counter DUT (a,b,c,d,e,f);
 
    initial 
    begin
      #0 a=1;b=1;
      #5 d=0;e=1;
       
       
    #10 $finish;
    end
    
initial
    begin
      $monitor("Time = %g    a =%b,b=%b,c=%b,d=%b,e=%b,f=%b", $time, a,b,c,d,e,f);
    end
endmodule



May I know the reason for this error?Thank you.
 
Last edited by a moderator:


Code Verilog - [expand]
1
2
3
4
5
module add (a,b,c);
    input a,b;
    output c
    assign c=a+b;
endmodule



May I know the reason for this error?Thank you.

Without commenting on the logic, I see that there is no semicolon for output c. Otherwise, it's simulating.
 

As suresh_ pointed out the only error is the missing semicolon for output c.

Logic wise the module names do not match the functionality of the implementation, e.g.:
1. add.v does nothing more than assign c=a+b;, which due to the single bit width a, b, and c can only be 0 or 1 so it instead implements an XOR operation: assign c=a^b;.
2. counter.v does nothing more than perform a parallel XOR operation on two different pairs of bits (a^b) and (d^e), which isn't counting.

This obviously isn't the code that had the problem with recursive instantiation, so I'm assuming you posted this code because you thought that your underlying logic was the root cause of the problem and not your recursive code, which I suspect was an attempt to iteratively make a counter out of single bit adds.


I still don't get why they teach Verilog like this...micro module instances to build up logic that is much easier to write behaviorally.

Code Verilog - [expand]
1
2
reg [15:0] counter;
always @ (posedge clk) counter <= counter + 1;

 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top