0% found this document useful (0 votes)
31 views

Verilog Syntax

This document describes basic Verilog concepts including modules, inputs, outputs, wires, registers, logic gates, bitwise operations, constants, conditions, register assignments, concatenation, and begin/end structures. It covers syntax for module definition, signal assignment, initialization, always blocks, and if/then/else conditional statements. Logic operations covered include AND, OR, NOT, NAND, NOR, XOR for both gates and bitwise operations.

Uploaded by

sravaniavvari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views

Verilog Syntax

This document describes basic Verilog concepts including modules, inputs, outputs, wires, registers, logic gates, bitwise operations, constants, conditions, register assignments, concatenation, and begin/end structures. It covers syntax for module definition, signal assignment, initialization, always blocks, and if/then/else conditional statements. Logic operations covered include AND, OR, NOT, NAND, NOR, XOR for both gates and bitwise operations.

Uploaded by

sravaniavvari
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as RTF, PDF, TXT or read online on Scribd
You are on page 1/ 3

Verilog Operations/Concepts

(Example file on class Web site under Verilog examples)

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

Constants and value assigments


432 Decimal 432
2’b11 Two bit binary number equal to decimal 3
8’hFF hex FF or 11111111 in binary
x Value not known
z Values is high impedence
1 one, logic high, Vcc
0 zero, logic low, ground

Logic and relations used for conditions


! Logical negation
&& Logical AND
|| Logical OR
== Logical equality (A==8’h FF Variable A equals the constant value FF)
!= Logical inequality
> Greater than
>= Greater than or equal to
> Less than
<= Less than or equal to

Mathematical equivalence inside conditions


Binary decision
(expression1)?(expression2) : (expression3)
If expression1 equals 1, then evaluate expression2 else evaluate expression3

Register Assignments
Blocking B=A, C=B

Result: C=A since operations are executed sequentially

Non-blocking B <=A, C<=B

Result: Concurrent operations occur on control signal (typically a clock).

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

You might also like