Professional Documents
Culture Documents
01 Verilog1 PDF
01 Verilog1 PDF
endmodule
Solderless 107
Breadboard
106
tangentsoft.net/elec/breadboard.html
105
No symbolic 104
execution or
testing 103
home.cogeco.ca 10
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-3
HDLs enabled logic level
simulation and testing
Number of Gates
Gate Level in Design
Description
107
Simulate
Test
106
Results
Manual 105
104
103
102
Simulate 106
Register Test
Transfer Level Results
105
Simulate 104
Test
Gate Level Results
103
102
Manual
10
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-5
HDLs led to tools for
automatic translation
Simulate Number of Gates
Behavioral Test in Design
Algorithm Results
107
Manual
Simulate 106
Register Test
Transfer Level Results
105
Logic Synthesis
Simulate 104
Test
Gate Level Results
103
Auto Place + Route
HDLs: Verilog, VHDL… 102
Tools: Spice, ModelSim,
DesignCompiler, … 10
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-6
Raising the abstraction
further …
Simulate Number of Gates
Guarded Atomic Test in Design
Actions Results
107
GAA Compiler
Simulate 106
Register Test
Transfer Level Results
105
Logic Synthesis
Simulate 104
Test
Gate Level Results
103
Auto Place + Route
102
10
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-7
The current situation
C, C++, Behavioral RTL MATLAB
SystemC Verilog, VHDL,
SystemVerilog
Structural RTL
Register
Verilog, VHDL,
Transfer Level
SystemVerilog
Logic Synthesis
Simulators and other tools Gate Level
are available at all levels but
not compilers from the
behavioral level to RTL
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-8
Verilog Fundamentals
History of hardware design languages
Data types
Structural Verilog
Simple behaviors
FA FA FA FA
endmodule
Value Meaning
0 Logic zero
1 Logic one
X Unknown logic value
Z High impedance, floating
?
memory_req
instruction
instruction
small_net
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-11
Bit literals
Binary literals
4’b10_11 8’b0000_0000
8’b0xx0_1xx1
Underscores
Hexadecimal literals
are ignored 32’h0a34_def1
endmodule
// HDL modeling of
4
// adder functionality
cout sum endmodule
adder FA FA FA FA
cout S
a b
module adder( input [3:0] A, B, cin
output cout, cout FA
output [3:0] S );
c
wire c0, c1, c2;
FA fa0( ... ); module FA( input a, b, cin
FA fa1( ... ); output cout, sum );
FA fa2( ... ); // HDL modeling of 1 bit
FA fa3( ... ); // full adder functionality
endmodule
endmodule Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-17
Connecting modules
A B
adder FA FA FA FA
cout S
endmodule
endmodule
The order of these continuous
assignment statements does not
matter.
They essentially happen in parallel!
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-23
mux4: Behavioral style
// Four input multiplexer
module mux4( input a, b, c, d
input [1:0] sel,
output out );
assign out = ( sel == 0 ) ? a :
( sel == 1 ) ? b :
( sel == 2 ) ? c :
( sel == 3 ) ? d : 1’bx;
endmodule
If input is undefined
we want to propagate
that information.
endmodule
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-27
What happens if the case
statement is not complete?
module mux3( input a, b, c
input [1:0] sel,
output out );
reg out;
always @( * ) We CAN prevent creating
begin state with a default
case ( sel )
2’d0 : out = a;
statement
2’d1 : out = b;
2’d2 : out = c;
default : out = 1’bx;
endcase
end
endmodule
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-28
Parameterized mux4
module mux4 #( parameter WIDTH = 1 ) default value
( input[WIDTH-1:0] a, b, c, d
input [1:0] sel,
output[WIDTH-1:0] out );
endmodule
Low-level netlist
Gate Level V of primitive gates
Auto Place + Route
Next time
Some examples
Courtesy of Arvind http://
csg.csail.mit.edu/6.375/ L02-36