Verilog Syntax
Verilog Syntax
Basic Syntax
module Begin definition of a module
endmodule End definition
input Define input variables and
vectors output Define output
variables and vectors wire Define
internal wire connections
assign Assign value of variable
reg Register containing state
variables initial Initialize state
variables at t=0 posedge
Positive edge of clock signal
always@(condition) Change state variables based on condition (typically clock edge)
Logic Gates
and AND gate
or OR gate
not NOT gate
nand NAND gate
nor NOR gate
xor XOR gate
Bit-by-bit logic
~ Bitwise NOT
& Bitwise AND
| Bitwise OR
^ Bitwise XOR
~& Bitwise NAND
~| Bitwise NOR
Register Assignments
Blocking B=A, C=B
Concatenation
{A,B} Combine A and B to create new vector/register
Begin/End structure
Basic structure for sequential operations (initial and always)
If/then/else structure
Conditional structure for sequential operations used inside begin/end structure.
2