System Verilog
language supported
- behaviorial level (algorithm or RTL(Register transfer) level)
- dataflow level
- gate level (structural level)
- switch level (transistor level)
Gate level Delays
- rise delay: from X to 1
- fall delay: from X to 0
- turn-off delay: from 1 to Z
- default time units: ps, or picosecond (10^-12 sec), default delay is 0
- it can be defined in order:
#(delay_time), #(rise_time, fall_time), #(rise_time, fall_time, turn-off_time) - it is also called transport delay, the change in input takes effect in the output after the delay time
switch level modeling
| switch type | sv switch primitives |
|---|---|
| ideal MOS switch | nmos, pmos, cmos |
| resistive MOS switch | rnmos, rpmos, rcmos |
| ideal bidirectional switch | tran, tranif0, tranif1 |
| resistive bidirectional switch | rtran, rtranif0, rtranif1 |
| power and ground nets | supply1, supply0 |
| pull up and pull down | pullup, pulldown |
NMOS output table
| in\control | 0 | 1 | x | z |
|---|---|---|---|---|
| 0 | z | 0 | L | L |
| 1 | z | 1 | H | H |
| x | z | x | x | x |
| z | z | z | z | z |
PMOS output table
| in\control | 0 | 1 | x | z |
|---|---|---|---|---|
| 0 | 0 | z | L | L |
| 1 | 1 | z | H | H |
| x | x | z | x | x |
| z | z | z | z | z |
cMOS output table
| control (n,p) | data=0 | data = 1 |
|---|---|---|
| 0 , 0 | 0 | 1 |
| 0 , 1 | z | z |
| 1 , 0 | 0 | 1 |
| 1 , 1 | 0 | 1 |
MUX implementation
always_comb vs assign
- use
always_combwithif-elseorcase, and more complex constructs - use
assignfordelays
| mux2to1.sv | |
|---|---|
| mux2to1.sv | |
|---|---|
Module Implementation and Declaration
in
vs, the primary block is called a module, it contains
example of a module Counter
-
port declaration:
<direction = input> <datatype = wire> <width = 1> <port name>where
<direction>can beinput,output,inout(bi-directional),<data type>can belogic,wire, etc. (wireis 4-state net,logicis 4-state net/variable,regdeprecated is 4-state variable),<width>can be1orn,eg:
input logic [3:0] a,inout [3:0] bNote
in sv, all module ports can be declared as
logicunless multiply driven
Port Connections
there are 2 types of port connections: named and positional
- named port connections: module_name instance_name(.port_name(signal_name))
- positional port connections: module_name instance_name(signal_name)
- named are preferred, since you can left out ports and self documenting
suppose we have
and we have top design




