Lec01 Verilog Combinational Circuits Design 2022 Spring
Lec01 Verilog Combinational Circuits Design 2022 Spring
Lec01 Verilog Combinational Circuits Design 2022 Spring
Combinational Circuit
Cell-based Full-Custom
Pro. Design speed Large design
is fast freedom
Con. Less design Design speed
freedom is slow
(Source: TSRI)
Specification Development
System Architecture
System models
Synthesis
Synthesis
Timing Verificaiton
Specify
Design a input/output
SPEC.
Calculator
relationship
Gate Level
Optimize result
Netlist
And Generate
Gate level netlist
4ns 3ns
Input Output
Gate Level
Netlist AND OR
Check correctness
Gate-sim after adding timing
information
Gate Level
Netlist
Decide each
Floorplan Components position
TSMC
Fabricate your
Fabrication design
Packing
& Testing
Test the IC is work
(Source: MTK)
CHIP
Produce Floorplan
Post-sim
And layout of Verification
your room Tape out
Fabrication TSMC
Construction Fabrication
And
Get your new room
Packing & Testing
we plan to design
Verilog and VHDL are both widely using in the IC company
The difference between HDL and other programming
Combinational circuit
trigger
ICLAB NCTU Institute of Electronics 26
Behavioral Modeling (2/3)
Using always construct (Proc. assignment)
assignment should be applied in topological order
Simulation from top to down
always@(a,b,x,c,d) begin
x = a & b;
trigger b
y = x | c | d;
end
a x
b
c y
d
Comments
single line : //
Abbreviation
clk sub-string for clocks
rst sub-string for resets
Suffix
_n for active-low, _z for tri-state, _a for async ,
Ex: rst_n => reset circuit at active-low
State Machine
[name]_cs for current state, [name]_ns for next state
Floating
Wire Reg
Memory
(Array) Vector
:
: For this reason, we do not
use array as memory,
Memory component will be
introduced later
wire
wire inout
wire or reg wire wire or reg wire
output input output input
Module Module Module
module MUX2_1(out,a,b,sel,clk,rst);
input sel,clk,rst; mux.v Wire for port
input a,b; module test; connection
output out; reg out; //incorrect define
Wire for input
wire c; reg a,b;
reg a,b; //incorrect define reg clk,sel,rst;
reg out;
// 1. connect port by ordering
//Continuous assignment MUX2_1 mux(out,a,b,sel,clk,rst);
assign c = (sel a:b;
// 2. connect port by name
//Procedural assignment, MUX2_1 mux(.clk(clk), .reset(rst),
//only reg data type can be assigned value .sel(sel), .a(a), .b(b), .out(out));
always@(posedge rst or posedge clk)
begin initial begin
Signed Operation
conditional assignment (? :)
?: c = sel ? a : b;
used in cont. assignment
same as if-else statement
d 0
c 1 0
b 0
1 out
sel Sel=10
a 1 a 00
Sel=01 b 01
Sel=00 c 10
d 11
2
Sel
a = b << 1;
can use without instance name i.e. and( out, in1, in2 ) ;
can use with multiple inputs i.e. xor( out, in1, in2, in3 ) ;
can use with multiple outputs i.e. not( out1, out2 ,in) ;
A
always@* begin
A=B+C;
end
always@* begin
A=B+D;
end B+C B+D
initial begin
A=B;
B=C;
end Initial use for PATTERN only!!
always@* begin
always@* begin
case(Q)
A=B;
default: A=D;
A=C;
endcase
else A=D;
end
end
Figure. (a) D-latch (b) D flip-flop
TESTBED.v
DESIGN.v PATTERN.v
Port declaration
input
data type declaration
Applying simulation
output
Display results
`timescale 1ns/10ps
PATTERN.v
module TESTBED;
wire out,a,b,sel,clk,reset;
enmodule
Pull Down
Menu
Signal
Window
Get signal
Use Signal Get Signals... command
Default : Hexadecimal
Reload nWave
Update fsdb file in Debussy database
File Reload
Hot key L (shift + l)