'timescale 1ns/1ns module top; parameter PERIOD=10; reg clk; reg A1; reg A2; reg A3; reg A4; reg B1; reg B2; reg B3; reg B4; wire Y1; wire Y2; wire Y3; wire Y4; quad_nand_2U_quad_2( .A1(A1 ),.A2(A2 ),.A3(A3 ),.A4(A4 ),.B1(B1 ),.B2(B2 ),.B3(B3 ),.Y1(Y1 ),.Y2(Y2 ),.Y3(Y3 ),.Y4(Y4 ) ); //clk gen initial begin clk=0; forever begin #(PERIOD/2)clk=~clk; end end //gen A1 initial begin A1=0; repeat(50)begin #(PERIOD)A1=$random; end end //gen A2 initial begin A2=0; repeat(50)begin #(PERIOD)A2=$random; end end //gen A3 initial begin A3=0; repeat(50)begin #(PERIOD)A3=$random; end end //gen A4 initial begin A4=0; repeat(50)begin #(PERIOD)A4=$random; end end //gen B1 initial begin B1=0; repeat(50)begin #(PERIOD)B1=$random; end end //gen B2 initial begin B2=0; repeat(50)begin #(PERIOD)B2=$random; end end //gen B3 initial begin B3=0; repeat(50)begin #(PERIOD)B3=$random; end end //gen B4 initial begin B4=0; repeat(50)begin #(PERIOD)B4=$random; end end initial begin #(PERIOD)B1=$random; end endmodule
时间: 2023-03-20 21:01:55 浏览: 152
(练习实验 2)寄存器组(Regfile)设计实验1
#时钟周期为10ns,使用quad_nand_2U_quad_2模块,实现4个输入口A1、A2、A3、A4,4个输出口Y1、Y2、Y3、Y4,以及4个复位口regA1、regA2、regA3、regA4,regB1、regB2、regB3、regB4。
阅读全文