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 port needs to be connected to all instances. my_dffclk 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.
Module shift - HDLBits (01xz.net)
1 module top_module ( input clk, input d, output q ); 2 wire q1,q2; 3 my_dff my_dff1( 4 .clk(clk), 5 .d(d), 6 .q(q1) 7 ); 8 my_dff my_dff2( 9 .clk(clk), 10 .d(q1), 11 .q(q2) 12 ); 13 my_dff my_dff3( 14 .clk(clk), 15 .d(q2), 16 .q(q) 17 ); 18 endmodule
wire的两个定义挺好的,值得思考,定义是必要的,但为什么自己思维固化了就没想到,程序写的也非常清晰
再写:
在这里不定义中间wire,也没法写对吧

浙公网安备 33010602011771号