module《模块名》
参数定义
端口类型说明
数据类型定义
assign
always initial
任务和函数
endmodule
//8位加法计数器 module counter8(out,cout,data,load,cin ,clk)
output【7:0】out;
output cout;
input load,cin,clk; // load初始位,cin是进位 input【7:0】data;
reg 【7:0】out; // reg寄存器类型 always@(posedge clk) //总是检测, @有when 的意思。 begin
if(load)
out=data //置数 else
out= out+cin ;//计数或保持 end
assign cout =&out&cin //&out = out【7】&out【6】。。。。&out【1】所有位endmodule
bufif1 bufif0 notif1 notif0 三态门
nand xnor 同或门
module gateinst (a,b,c,d,y)
input a,b,c,d
output y
wire x
and andgate(x,a,