CSE460 Lab-2 Presentation
CSE460 Lab-2 Presentation
to Digital
Design in
Verilog
Prepared by
Beig Rajibul Hasan &
Md. Asif Hossain Bhuiyan
Lecturer, CSE, BRAC University
• Attendance (All 6) - 5%
• Class work - 5%
Lab Policy • Lab test - 5%
• Presentation - 10%
• Total - 25%
Design Entry
Schematic
Source Code
Capture
Design
Flowchart Logic
Synthesis
of a Typical a b
Simulation
CAD 0
0
0
1
1
1
1
0
System 1
1
0
1
1
0
0
0
Design
Correct?
No
Yes
Physical
Design
Chip configuration
CSE460 : VLSI Design 5
• A module is the basic building block of Verilog. A
Basic building module consists of port declaration and Verilog
codes to perform the desired functionality.
block of Verilog
• Ports are means for the Verilog module to
communicate with other modules or interfaces.
Ports can be of 3 types, such as: input, output,
inout.
Input Output
<name> • A typical Verilog module declaration:
• Number specification
- There are two types of number specifications found in verilog, sized and unsized.
- sized numbers are represented as: <size> ‘<base format> <number>. Supported formats
are:
Base format Illustration
d decimal
b binary
h hexadecimal
o octal
CSE460 : VLSI Design 10
Basic Syntax and Lexical Conventions
- If a number is specified without a base format, it is treated as a decimal number by the
Verilog compiler.
- unsized numbers are specified without a size specification. unsized numbers are assigned
a specific number of bits which is simulator and machine-specific (at least 32 bits).
sized number representation unsized number representation
5’b10001 // This is a 5-bit binary number 1254 // This is a 32-bit decimal number by default
4’hff01 // This is a 4-bit hexadecimal number ‘h21ff // This is a 32-bit hexadecimal number
3’o123 // This is a 3-bit octal number ‘o345 // This is a 32-bit octal number
2’d10 // This is a 2-bit decimal number ‘b1100 // This is a 32-bit binary number
Condition in
• Value Set Value level
Hardware
- Each individual signal/variable in Verilog can be assigned one 0 logic 0 / False
of 4 values: 1 logic 1 / True
x undefined
z high impedance
CSE460 : VLSI Design 11
How to assign numerical values to the circuit nodes?
❖ Verilog makes use of the reserved keyword assign to easily store numerical values in a variable.
❖ The assign statements are concurrent, meaning that they are executed in parallel.
endmodule
input [2:0]in;
output [2:0]out;
assign x = a & b;
assign y = c | d;
endmodule
wire g, y, h;
Basic Syntax and <data type> <MSB bit index : LSB bit index> <name>
❑ Bitwise operators
❑ Logical operators
Verilog ❑ Arithmetic operators
Operators ❑ Relational operators
❑ Shift operators
❑ Condition operator
Operator Operation
Operator Operation
Operator Operation
A+B Addition of two single or multibit numbers
Verilog A-B Subtraction of two single or multibit numbers
Operators A*B
A/B
Multiplication of two single or multibit numbers
Division of two single or multibit numbers
A%B This returns the remainder of the integer division A/B
Operator Operation
A == B 1 (True) if A is equal to B, 0 (False) otherwise
Verilog A != B 1 (True) if A is not equal to B, 0 (False) otherwise
Operators A>B
A<B
1 (True) if A is greater than B, 0 (False) otherwise
1 (True) if A is less than B, 0 (False) otherwise
assign S = A ^ B ^ Cin;
assign Cout = (A & B) | (Cin & (A ^ B));
endmodule