??? > ? > >
Verilog HDL??--?
? ?2013-11-3 17:29:06 ?
Verilog HDL????Verilog HDL????Verilog HDL??Verilog HDL?????????????????Verilog HDL??Verilog????????????5?
- ??system??????????
- ?algorithm????????
- RTLRegister Transfer Level???ħ???
- ?gate-level???????
- ?switch-level????????
????Verilog HDL??Verilog HDL?y????????y?????????????Verilog HDL?????????????????
Verilog HDL?????????????RTL????1?
- ?????
- ???????????
- ???????
- ?if-elsecase??
- ?????task?
- ??????function
- ????
- Verilog HDL???????????????1?
- ????primitive
- ??????
- ?MOS???????
Verilog HDL?????????Verilog HDL????????????????????څ???????
Verilog HDL??????C??if?case?C?????C??????Verilog HDL???Verilog HDL?????????????Verilog HDL???
Verilog HDL
Verilog HDL?Verilog HDL?
1?
module adder count,sum,a,b,cin ; //???
input 2:0 a,b; //??
input cin;
output count;
output 2:0 sum;
assign {count,sum} = a + b + cin; //???
endmodule
????adder??ab?cin?sum?count?Verilog HDL?moduleendmodule?
2?
module compare equal,a,b ; //???
output equal; //?equal
input 1:0 a,b; //?ab
assign equal=a==b10; //ab ?,?1,?0
endmodule
????compare??ab??ab?equal??????“/*........*/”“//.........”???????????????
3???
module trist2out,in,enable; //???
output out; //??
input in, enable;
bufif1 mybufout,in,enable; //??bufif1
endmodule
??trist2???Verilog?????bufif1??
4??
module trist1out,in,enable; //???
output out; //??
input in, enable;
mytri tri_instout,in,enable;//?mytri?E??tri_inst
endmodule
module mytriout,in,enable; //???
output out; //??
input in, enable;
assign out = enable? in : 'bz; //??
endmodule
????????trist1?mytri??tri_inst?trist1???mytri????
???
- Verilog HDL?y??????moduleendmodule???????????????,????????????,?????
- ?????,?,??????
- Verilog HDL?,?,???է
- endmodule,????
- “/*.....*/”“//.......”Verilog HDLʦ????????????,???????
??
??I/OI/O?????^
1I/O
???????
Module ??1?2?3?4, …;
2I/O?
I/O???
?input ?1?2…?i //i?
?output ?1?2…?j //j?
I/O??????
module module_nameinput port1,input port2,…,output port1,output port2…
3??
?????wirereg?
reg width-1 : 0 R1R2 …
wire width-1 : 0 W1W2 …
4?
??????3???
1“assign”?
assign a = b & c;
????????“assign”???????
2??
and and_inst q, a, b ;
????????????????and??and_inst??ab?q?????????and?
3“always”
always @posedge clk or posedge clr begin //???
ifclr q <= 0; //
else ifen q <= d; //???
end
“assign”??????“always”?????“always”???D
“always”???“if...else”????“always”?????????????????Verilog???????????
3??“assign”???“always”3???????3?Verilog?????????????3???????
?“always”????????“always”?“?”??????“always”???????????
?“always”???????“if…else… if”????ʉ^elseif???????????“always”??ާ??
- 1
- 2
- ??
?????
- ?? ????
- ?? Verilog HDLC??