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.

[Moved] Verilog Question about instantiating

Status
Not open for further replies.

geozog86

Member level 3
Joined
Oct 24, 2010
Messages
54
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,286
Activity points
1,774
First of all i want you to forgive me for placing this Q here, where should I? didn't find any match for verilog/vhdl questions!

And now the question, which is pretty basic: when i instantiate a module in another module, and i open a parenthesis to give values to the inputs/outputs, i have

inst a (.in1(value1)
.in2(value2)
.out1(value3)
);

What exactly happens with the .commands? Are the first 2 (in1/2 take the values1/2) but for the output (out1 write your value in value3)? Or what? Am i giving value to the output???

Sorry have no experience in verilog, only vhdl, and i can't find anywhere the answer to my question!

thx
 

Re: Verilog Question about instantiating

the dot is used to Tie the variables mostly ina different module or loop. Example the varialble "var_in_this_module" is tied to the variable (a kind of assign) in the other module or instance by ".var_in_other_module(var_in_this_module)" .. as soon as var_in_this_module gets a value its transferred to var_in_other_module... hope u get me...
 
Re: Verilog Question about instantiating

Thx for the reply, i re-read the code this morning, but my question remains: How can i tie the output of the "other module" to any value of this module?? Shouldn't i only tie the inputs of the other module, and USE the output the other module produces? Maybe it works the other way then, and when var_in_other_module_OUTPUT_changes then it is transferred to the .var_in_this_module?
 

Re: Verilog Question about instantiating

mod1 mod1_tb(.en(tb_en),.rst(tb_rst),.clk(tb_clk),.count(tb_count));

in d above example, mod1 is my actual module ... mod1_tb is another module .....
.
the variables .en,.rst,.clk are from module 1..
.
the variables tb_*** belong to mod1_tb...
.
this is how u tie them.. ensure that they r in d same project/workspace....

---------- Post added at 10:55 ---------- Previous post was at 10:53 ----------


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
38
39
40
41
42
43
44
45
46
47
48
// this a sample program to help u learn how to tie the variables
// hope if u understand the module u ll realise...
/// also try simulating them
 
module mod1 (en, clk, count,rst);
input en,rst;
input clk;
output reg [3:0] count ;
 
always@(posedge clk) 
begin
      if (en==1'b0) begin
         count<=4'b0000;
      end else if (en ==1'b1) begin
         count<=count+4'b0001;
    end else if (rst) begin
         count<=4'b0000;
    end      
        
end
endmodule
 
module mod1_tb ();
    reg tb_en, tb_clk, tb_rst;
    wire [3:0] tb_count;
    
mod1 mod1_tb(.en(tb_en),.rst(tb_rst),.clk(tb_clk),.count(tb_count));
 
initial
begin
 
tb_en=0;
tb_rst=0;
tb_clk=0;
 
#50 tb_rst=1;
#50 tb_rst=0;
#50 tb_en=1;
#1800 tb_en=0;
   
#2000 $finish;
end
 
always
begin
#50 tb_clk=~tb_clk;
end
endmodule

 
Last edited by a moderator:

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top