2021-10-21

Verilog Language

Modules:Hierarchy

Three modules

You are given a module my_dff with two inputs and one output (that implements a D flip-flop). Instantiate three of them, then chain them together to make a shift register of length 3. The clk port needs to be connected to all instances.

The module provided to you is: module my_dff ( input clk, input d, output q );

Note that to make the internal connections, you will need to declare some wires. Be careful about naming your wires and module instances: the names must be unique.

您将获得一个具有两个输入和一个输出(实现 D 触发器)的模块 my_dff。 实例化其中三个,然后将它们链接在一起以形成长度为 3 的移位寄存器。 clk 端口需要连接到所有实例。

提供给你的模块是:module my_dff ( input clk, input d, output q );

请注意,要进行内部连接,您需要声明一些电线。 命名电线和模块实例时要小心:名称必须是唯一的。请添加图片描述
Module Declaration
module top_module ( input clk, input d, output q );

module top_module ( input clk, input d, output q );
	wire a;//线网类型,接受第一个寄存器的输出
    wire b;
    my_dff my_dff1(clk,d,a);
    my_dff my_dff2(clk,a,b);
    my_dff my_dff3(clk,b,q);
   
    
endmodule
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值