Designing with Verilog - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

Designing with Verilog

Description:

11/14/09. EECS150 Lab Lecture #2. 1. Designing with Verilog ... or or1( COut, CGenerate, CPropagate); FDCE FF( .Q( Out), .C( Clock), .CE( Enable), .CLR( Reset) ... – PowerPoint PPT presentation

Number of Views:29
Avg rating:3.0/5.0
Slides: 28
Provided by: GregGi7
Category:
Tags: designing | or1 | verilog

less

Transcript and Presenter's Notes

Title: Designing with Verilog


1
Designing with Verilog
  • EECS150 Spring 2007 Lab Lecture 2
  • Young Lee
  • Greg Gibeling

2
Today
  • Top-Down and Bottom-Up
  • Partitioning Interfaces
  • Behavioral vs. Structural Verilog
  • Administrative Info
  • Blocking and Non-Blocking
  • Verilog and Hardware
  • Lab 2
  • Primitives

3
Top-Down vs. Bottom-Up (1)
  • Top-Down Design
  • Start by defining the project
  • Then break it down
  • Starts here

4
Top-Down vs. Bottom-Up (2)
  • Top-Down Design
  • Ends here

5
Top-Down vs. Bottom-Up (3)
  • Bottom-Up Testing
  • Faster, Easier and Cheaper
  • Test each little component thoroughly
  • Allows you to easily replicate working components

6
Partitioning Interfaces (1)
  • Partitioning
  • Break the large module up
  • Decide what sub-modules make sense
  • Partitioning is for your benefit
  • It needs to make sense to you
  • Each module should be
  • A reasonable size
  • Independently testable
  • Successful partitioning allows easier
    collaboration on a large project

7
Partitioning Interfaces (2)
  • Interfaces
  • How different partitions talk to one another
  • A concise definition of signals and timing
  • Timing is vital, do NOT omit it
  • Must be clean
  • Dont send useless signals across
  • Bad partitioning might hinder this
  • An interface is a contract
  • Lets other people use/reuse your module

8
Behavioral vs. Structural (1)
  • Rule of thumb
  • Behavioral doesnt have sub-components
  • Structural has sub-components
  • Instantiated Modules
  • Instantiated Gates
  • Instantiated Primitives
  • Most modules are mixed
  • Obviously this is the most flexible

9
Behavioral vs. Structural (2)
10
Behavioral vs. Structural (3)
11
Administrative Info
  • Lab Grading
  • Get it in by the opening of the next lab
  • Partial credit will be given for incomplete labs
  • Card Key Access for All is coming soon!
  • Start looking for partners!

12
Blocking vs. Non-Blocking (1)
Verilog Fragment
Result
always _at_ (a) begin b a c b end
C B A A-----B-------C
B Old A C Old B
always _at_ (posedge Clock) begin b lt a c lt
b end
13
Blocking vs. Non-Blocking (2)
  • Use Non-Blocking for FlipFlop Inference
  • posedge/negedge require Non-Blocking
  • Else simulation and synthesis wont match

14
Blocking vs. Non-Blocking (3)
  • If you use blocking for FlipFlops

YOU WILL NOT GET WHAT YOU WANT!
always _at_ (posedge Clock) begin b a // b will
go away c b // c will be a FlipFlop end // b
isnt needed at all
always _at_ (posedge Clock) begin c b // c will
be a FlipFlop b a // b will be a FlipFlop end
15
Blocking vs. Non-Blocking (4)
Race Conditions
file xyz.v module XYZ(A, B, Clock) input B,
Clock output A reg A always _at_ (posedge
Clock) A B endmodule
file abc.v module ABC(B, C, Clock) input C,
Clock output B reg B always _at_ (posedge
Clock) B C endmodule
THIS IS WRONG
16
Blocking vs. Non-Blocking (5)
Race Conditions
file xyz.v module XYZ(A, B, Clock) input B,
Clock output A reg A always _at_ (posedge
Clock) A lt B endmodule
file abc.v module ABC(B, C, Clock) input C,
Clock output B reg B always _at_ (posedge
Clock) B lt C endmodule
THIS IS CORRECT
17
Verilog and Hardware (1)
assign Sum A B
reg 10 Sum always _at_ (A or B) begin Sum A
B end
18
Verilog and Hardware (2)
assign Out Select ? A B
reg 10 Out always _at_ (Select or A or B)
begin if (Select) Out A else Out B end
19
Verilog and Hardware (3)
assign Out Sub ? (A-B) (AB)
reg 10 Out always _at_ (Sub or A or B) begin if
(Sub) Out A - B else Out A B end
20
Verilog and Hardware (4)
reg 10 Out always _at_ (posedge Clock) begin if
(Reset) Out lt 2b00 else Out lt In end
21
Lab 2 (1)
  • Lab2Top
  • Accumulator
  • Stores sum of all inputs
  • Written in behavioral verilog
  • Same function as Lab1Circuit
  • Peak Detector
  • Stores largest of all inputs
  • Written in structural verilog

22
Lab 2 (2)
23
Lab 2 (3)
Accumulator.v
24
Lab 2 (4)
PeakDetector.v
25
Primitives (1)
wire SIntermediate, SFinal, CPropagrate,
CGenerate xor xor1( SIntermediate, In, Out)
and and1( CGenerate, In, Out) xor xor2( SFinal,
SIntermediate, CIn) and and2( CPropagate, In,
CIn) or or1( COut, CGenerate, CPropagate) F
DCE FF( .Q( Out), .C( Clock), .CE( Enable
), .CLR( Reset), .D( SFinal))
26
Primitives (2)
wire SIntermediate, SFinal, CPropagrate,
CGenerate xor xor1( SIntermediate, In, Out)
and and1( CGenerate, In, Out) xor xor2( SFinal,
SIntermediate, CIn) and and2( CPropagate, In,
CIn) or or1( COut, CGenerate, CPropagate) F
DCE FF( .Q( Out), .C( Clock), .CE( Enable
), .CLR( Reset), .D( SFinal))
27
Primitives (3)
wire SIntermediate, SFinal, CPropagrate,
CGenerate xor xor1( SIntermediate, In, Out)
and and1( CGenerate, In, Out) xor xor2( SFinal,
SIntermediate, CIn) and and2( CPropagate, In,
CIn) or or1( COut, CGenerate, CPropagate) F
DCE FF( .Q( Out), .C( Clock), .CE( Enable
), .CLR( Reset), .D( SFinal))
Write a Comment
User Comments (0)
About PowerShow.com