verilog hdl中top模块调用子模块的问题
答案:3 悬赏:0
解决时间 2021-04-07 16:58
- 提问者网友:无心恋土
- 2021-04-07 14:10
在top模块中调用两个z1,z2子模块,z1的输出端口是c,而它将作为z2的输入端口,就是想问子模块z2怎样使用子模块z1输出端口的值,怎样连接,请尽量具体点嘛!
最佳答案
- 二级知识专家网友:修女的自白
- 2021-04-07 15:16
这个就例化过程:
你可以在top层,wire temp
z1 u1(.c(temp)
);
z2 u2(.d(temp)
);
d为z2的输入端口,请问你明白了吗
你可以在top层,wire temp
z1 u1(.c(temp)
);
z2 u2(.d(temp)
);
d为z2的输入端口,请问你明白了吗
全部回答
- 1楼网友:承载所有颓废
- 2021-04-07 16:15
//Z2模块
module Z2(input a2,..., output b);
......
Z1 q1(input a1,..., output c);
assign a2=c;
............
endmodule
//Z1模块
module Z1(input a1,..., output c);
.....
endmodule
- 2楼网友:无字情书
- 2021-04-07 15:58
可以在top层,wire tempz1 u1(.c(temp));z2 u2(.d(temp));d为z2的输入端口。
一、//z2模块
module z2(input a2,..., output b);
......
z1 q1(input a1,..., output c);
assign a2=c;
............
endmodule
//z1模块
module z1(input a1,..., output c);
.....
endmodule
二、verilog在调用模块的时候(也称模块实例化),信号端口可以通过位置或名称关联,nd a1 (t3, a1, b 1); //a1为调用and这个模块的一个加法器,在对a1进行实例化时采用位置关联,t3对应输出端口c,a对应a1,b对应b1。
三、nd a2(.c(t3),.a(a2),.b(b2));//在对a2实例化时采用名字关联,c是and 器件的端口,其与信号t3相连,a对应a2,b对应b2。
我要举报
如以上问答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯