Verilog 2
Verilog 2
11-9-23
ECE/EEE/INSTR F215 (DIGITAL DESIGN)
PROF. ANITA AGRAWAL, BITS, PILANI- K.K.BIRLA GOA CAMPUS
INTEGER CONSTANTS
16’b1001_1100_1110_0001
197_832_001
The digits ‘x’ or ‘X’ and ‘z’ or ‘Z’ : unknown and high
impedance’ values, respectively.
Can be used in binary, octal and hexadecimal numbers
(not in decimal)
A single ‘x’ or ‘z’ extends to four bits if used in a
hexadecimal number, to three in octal, and one in
binary.
ANITA AGRAWAL CS/ECE/EEE/INSTR F215 10/6/2023 12:35 AM 7
EXAMPLES
10/6/2023 12:35 AM 8
10/6/2023 12:35 AM
EXAMPLE
Let A=4’b0011, B=4’b0100, D=6, E=4, F=2
A*B
A+B
B –A
D/E
D%E
F = E ** F
Note: If any operand bit has a value x, then the result of the entire expression is x. 12
10/6/2023 12:35 AM
ANITA AGRAWAL CS/ECE/EEE/INSTR F215
SOME MORE EXAMPLES……
13 % 3 = 1 ; 13/3 = 4
16 % 4 = 0 ; 16/4 = 4
-7 % 2 = -1 ; -7/2 = -3
7 % -2 = 1 ; 7/-2 = 3
Expressions
(a==2) && (b==3) //evaluates to 1 if both a ==2 and
b==3 are true, else to 0
10/6/2023 12:35 AM 15
ANITA AGRAWAL CS/ECE/EEE/INSTR F215
Operator Type Operator Operation Number of
Symbol performed operands
Relational > Greater than two
< Less than two
>= Greater than two
or equal
10/6/2023 12:35 AM
Relational operators:
Akin to C language
Logical: ==, !=