Title: Combinational Design Part II with Verilog
1Combinational Design Part II(with Verilog)
2Administrative
3Topics
- Positive vs. negative logic
- Design procedure
- Intro to Verilog
- Design examples
- Verification
- Simulation
- Programmable logic
4Positive and Negative Logic
- Using H to signify a logic 1 (true) is known as
positive logic - Misleading name -- regardless of actual voltages
vs. gnd - Using H to signify 0 is negative logic
5Negative Logic
6AND Gate Specification
7Positive vs. Negative Logic
8Bottom Line
- Not much real change
- Negative logic functions are just duals of
positive logic ones - OR -gt AND
- AND -gt OR
9Design Procedure
- Similar to software
- Specification likely problem description
- Formulation as truth table, Boolean function,
or Verilog - Optimization used to be manual, now CAD tool
- Mapping to the implementation technology
- Verification used to be manual, now simulation.
Especially important if fab involved!
10Building Blocks and Verilog
- Well look at Verilog coding styles and syntax as
we learn standard building blocks
11Example 1
- Output is 1 when input lt 011
12Structural Verilog
- Explicit description of gates and connections
- Textual form of schematic
- Specify netlist
13Example 1 in Structural Verilog
- module example_1(X,Y,Z,F)
- input X
- input Y
- input Z
- output F
- //wire X_n, Y_n, Z_n, f1, f2
- not
- g0(X_n, X),
- g1(Y_n, Y),
- g2(Z_n, Z)
- nand
- g3(f1, X_n, Y_n),
- g4(f2, X_n, Z_n),
- g5(F, f1, f2)
- endmodule
Can also be input X, Y, Z
14Slight Variation Gates not named
- module example_1_c(X,Y,Z,F)
- input X
- input Y
- input Z
- output F
- not(X_n, X)
- not(Y_n, Y)
- not(Z_n, Z)
- nand(f1, X_n, Y_n)
- nand(f2, X_n, Z_n)
- nand(F, f1, f2)
- endmodule
15Explanation
- Each of these gates is an instance
- In first example, they had names
- not
- g0(X_n, X),
- In second example, no name
- not(X_n, X)
- Later see why naming useful
16Gates
- Standard set of gates available
- and, or, not
- nand, nor
- xor, xnor
- buf
17Dataflow Description
module example_1_b(X,Y,Z,F) input X
input Y input Z output F assign F
(X Y) (X Z) endmodule
- Basically a logical expression
- No explicit gates
18Technology Mapping
- Full custom
- Pixel-Planes chips (machines in lobby)
- Memories, CPUs, etc
- Standard cell
- Library of cells
- Engineer determined interconnection
- Gate arrays
- Small circuits with interconnect
19Verification
20Analysis of Circuit
- Next section shows disciplined way to analyze
circuit - To get Boolean function
- and/or Truth table
- You have enough knowledge now
- This is meant to make it more systematic
21Derivation of Boolean Func.
- Label gate outputs of input variables
- Determine Boolean functions
- Label outputs of gates fed by previously labeled
gates - Determine Boolean function
- Repeat 2 until done
22Lets Do This Example
23Derivation of Truth Table
- Make table with 2n rows, where n is number of
inputs - Label some gate outputs
- Put those labels and the final outputs on columns
of truth table - Work your way across
24Simulation
- The practical way to verify large circuits
- This weeks lab
- Computer figures out logic
- From schematic capture or HDL
- You specify test vectors (inputs)
- Developing these can be hard
- Simulation possibly with propagation delays
25Example 4-bit Equality
- Example 3-4 in book
- Input 2 vectors A(30) and B(30)
- Output One bit, E, which is 1 if A and B are
bitwise equal, 0 otherwise
26Design
- Hierarchical design seems a good approach
- One module/bit
- Final module for E
27Design for MX module
- Logic function in book is
- Id call this not E, but
- Can implement as
28Design for ME module
- Final E is 1 only if all intermediate values are
0 - So
- And a design is
29Hierarchical Verilog
- We already saw example of instantiation when we
used AND and OR gates - Just use module name and an identifier for the
particular instance
30Vector of Wires (Bus)
- Denotes a set of wires
- input 10 S
- Syntax is a b where a is high-order
- So this could be 01 S
- Order will matter when we make assignments with
values bigger than one bit - Or when we connect sets of wires
- NOTE THIS IS NOT AN ARRAY!
31DEMO
- Lets try entering the hierarchical example
- Then simulate it
32Learned
- Simple waveform generation
- How to look at intermediate variables
- How to recompile in ModelSim
- Not to use unless you mean it
- Next slides document design
- Just for your notes
33MX
- module mx(A, B, E)
- input A, B
- output E
- assign E (A B) (A B)
- endmodule
34ME
- module me(E, Ei)
- input 30 Ei
- output E
- assign E (Ei0 Ei1 Ei2 Ei3)
- endmodule
35Top Level
- module top(A, B, E)
- input 30 A
- input 30 B
- output E
- wire 30 Ei
- mx m0(A0, B0, Ei0)
- mx m1(A1, B1, Ei1)
- mx m2(A2, B2, Ei2)
- mx m3(A3, B3, Ei3)
- me me0(E, Ei)
- endmodule
36Verilog Testbench
- Later well cover more complex Verilog
- Can use to generate test vectors
- Much more convenient than the graphical input
37Code Converters
- One code to another
- Book puts seven-segment decoder in this category
- Typically multiple outputs
- Each output has function or truth table
38Seven-Segment Decoder
- This Fridays lab Verilog of hex to LEDs
- Extended version of book example
- You may want to work out mapping (truth
table/function) before lab
39Programmable parts
- Look at simple ones
- Switch PPT file
40Today
- Overview of CAD tools
- Design procedure
- Introduction to Verilog
- Simulation
- Simple programmable parts
- Lab preview
41Next Time
- More basic combinational circuits
- Decoder
- Encoder
- Multiplexer
- Adders
- More Verilog
42Read
- Chapter 4, Sections 1-5 and Section 8