CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

Similar documents
CSE140L: Components and Design Techniques for Digital Systems Lab. Verilog HDL. Instructor: Mohsen Imani UC San Diego. Source: Eric Crabill, Xilinx

Techniques for Digital Systems Lab. Verilog HDL. Tajana Simunic Rosing. Source: Eric Crabill, Xilinx

This Lecture. Some components (useful for the homework) Verilog HDL (will continue next lecture)

Digital Circuit Design and Language. Datapath Design. Chang, Ik Joon Kyunghee University

Numbering Systems. Number Representations Part 1

Arithmetic Circuits. Nurul Hazlina Adder 2. Multiplier 3. Arithmetic Logic Unit (ALU) 4. HDL for Arithmetic Circuit

CS Computer Architecture. 1. Explain Carry Look Ahead adders in detail

MASSACHUSETTS INSTITUTE OF TECHNOLOGY Department of Electrical Engineering and Computer Sciences

Digital Logic & Computer Design CS Professor Dan Moldovan Spring 2010

ECE468 Computer Organization & Architecture. The Design Process & ALU Design

FPGA Design Challenge :Techkriti 14 Digital Design using Verilog Part 1

EE178 Lecture Verilog FSM Examples. Eric Crabill SJSU / Xilinx Fall 2007

Hardware Description Languages (HDLs) Verilog

Arithmetic Logic Unit. Digital Computer Design

Lecture 32: SystemVerilog

CENG 241 Digital Design 1

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008

Course Details: Webpage

DLD VIDYA SAGAR P. potharajuvidyasagar.wordpress.com. Vignana Bharathi Institute of Technology UNIT 3 DLD P VIDYA SAGAR

Computer Architecture Set Four. Arithmetic

Writing Circuit Descriptions 8

First Name: Last Name: PID: CSE 140L Exam. Prof. Tajana Simunic Rosing. Winter 2010

Lecture 15: System Modeling and Verilog

Combinational Logic II

EE 8351 Digital Logic Circuits Ms.J.Jayaudhaya, ASP/EEE

EE 101 Lab 5 Fast Adders

EE 231 Fall EE 231 Homework 8 Due October 20, 2010

Logic Circuits II ECE 2411 Thursday 4:45pm-7:20pm. Lecture 3

Synthesizable Verilog

ECE 2300 Digital Logic & Computer Organization. More Sequential Logic Verilog

Verilog Behavioral Modeling

ECE 2300 Digital Logic & Computer Organization. More Finite State Machines

Why Should I Learn This Language? VLSI HDL. Verilog-2

Chapter 5 Registers & Counters

FPGA for Complex System Implementation. National Chiao Tung University Chun-Jen Tsai 04/14/2011

Chapter 5. Digital Design and Computer Architecture, 2 nd Edition. David Money Harris and Sarah L. Harris. Chapter 5 <1>

Combinational Logic Use the Boolean Algebra and the minimization techniques to design useful circuits No feedback, no memory Just n inputs, m outputs

Date Performed: Marks Obtained: /10. Group Members (ID):. Experiment # 11. Introduction to Verilog II Sequential Circuits

EECS 151/251A: SRPING 2017 MIDTERM 1

Verilog 1 - Fundamentals

Synthesis of Language Constructs. 5/10/04 & 5/13/04 Hardware Description Languages and Synthesis

In this lecture, we will go beyond the basic Verilog syntax and examine how flipflops and other clocked circuits are specified.

Speaker: Shao-Wei Feng Adviser: Prof. An-Yeu Wu Date: 2010/09/28

Topics. Midterm Finish Chapter 7

Engin 100 (section 250), Winter 2015, Technical Lecture 3 Page 1 of 5. Use pencil!

Recommended Design Techniques for ECE241 Project Franjo Plavec Department of Electrical and Computer Engineering University of Toronto

Introduction to Verilog HDL. Verilog 1

P-1/P-105. Samir Palnitkar. Prentice-Hall, Inc. INSTRUCTOR : CHING-LUNG SU.


C A R L E T O N U N I V E R S I T Y. FINAL EXAMINATION April Duration: 3 Hours No. of Students: 108

EXPERIMENT #8: BINARY ARITHMETIC OPERATIONS

Learning Outcomes. Spiral 2-2. Digital System Design DATAPATH COMPONENTS

VLSI Implementation of Adders for High Speed ALU

ECEN 468 Advanced Logic Design

Digital design laboratory 5

Verilog introduction. Embedded and Ambient Systems Lab

CSE140L: Components and Design Techniques for Digital Systems Lab

Verilog Coding Guideline

Counters, Timers and Real-Time Clock

Computer Organization EE 3755 Midterm Examination

ECE 341. Lecture # 6

Synthesis of Combinational and Sequential Circuits with Verilog

Introduction to Digital Design with Verilog HDL

Verilog Fundamentals. Shubham Singh. Junior Undergrad. Electrical Engineering

Introduction to Verilog/System Verilog

1 /10 2 /12 3 /16 4 /30 5 /12 6 /20

LABORATORY # 6 * L A B M A N U A L. Datapath Components - Adders

Chapter 3 Part 2 Combinational Logic Design

Chap 6 Introduction to HDL (d)

CSE140L: Components and Design

ENEE245 Digital Circuits and Systems Lab Manual

Henry Lin, Department of Electrical and Computer Engineering, California State University, Bakersfield Lecture 7 (Digital Logic) July 24 th, 2012

ECE 152A LABORATORY 2

Chapter 3 Arithmetic for Computers

Don t expect to be able to write and debug your code during the lab session.

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

In the previous lecture, we examined how to analyse a FSM using state table, state diagram and waveforms. In this lecture we will learn how to design

Register Transfer Level in Verilog: Part I

EPC6055 Digital Integrated Circuits EXAM 1 Fall Semester 2013

VHDL VS VERILOG.

CPE 335 Computer Organization. MIPS Arithmetic Part I. Content from Chapter 3 and Appendix B

Homework deadline extended to next friday

Week 7: Assignment Solutions

LAB #1 BASIC DIGITAL CIRCUIT

Under-Graduate Project Logic Design with Behavioral Models

Verilog Tutorial (Structure, Test)

Lecture 2: Data Types, Modeling Combinational Logic in Verilog HDL. Variables and Logic Value Set. Data Types. Why use an HDL?

ECE 353 Lab 3 (Verilog Design Approach)

ECE Digital Engineering Laboratory. Designing for Synthesis

VERILOG HDL. (and C) 1 ENGN3213: Digital Systems and Microprocessors L#5-6

Part I: Translating & Starting a Program: Compiler, Linker, Assembler, Loader. Lecture 4

Hardware description languages

CS/EE Homework 7 Solutions

Digital Design with SystemVerilog

Combinational Circuits

CSE 140L Final Exam. Prof. Tajana Simunic Rosing. Spring 2008


M A S S A C H U S E T T S I N S T I T U T E O F T E C H N O L O G Y DEPARTMENT OF ELECTRICAL ENGINEERING AND COMPUTER SCIENCE

Lab 6 : Introduction to Verilog

Design and Characterization of High Speed Carry Select Adder

Transcription:

CSE4L: Components and Design Techniques for Digital Systems Lab Verilog HDL Instructor: Mohsen Imani UC San Diego Source: Eric Crabill, Xilinx

System Tasks The $ sign denotes Verilog system tasks, there are a large number of these, most useful being: $display( The value of a is %b, a); Used in procedural blocks for text output. The %b is the value format (binary, in this case ) $monitor Similar to display, but executes every time one of its parameter changes $finish; Used to finish the simulation. Use when your stimulus and response testing is done. $stop; Similar to $finish, but doesn t exit simulation.

Blocking/Non-Blocking Assignments Blocking assignments (X=A) completes the assignment before continuing on to next statement Non-blocking assignments (X<=A) completes in zero time and doesn t change the value of the target until a blocking point (delay/wait) is encountered Watch out for assignments with delay! Examples follow. 3

Blocking Delay Unintended Behavior 4

Assign Delay Correct Behavior 5

Nonblocking delay expected behavior 6 Source: http://www.sunburst-design.com/papers/cummingshdlcon999_behavioraldelays_rev_.pdf

Driving a simulation through a testbench module testbench (x, y); output x, y; reg [:] cnt; 2-bit vector initial begin cnt = ; repeat (4) begin # cnt = cnt + ; $display ("@ time=%d, x=%b, y=%b, cnt=%b", $time, x, y, cnt); end # $finish; end initial block executed only once at start of simulation print to a console assign x = cnt[]; assign y = cnt[]; endmodule directive to stop simulation

Delay Control Generation of clock and resets in testbench: reg rst, clk; initial begin end always begin end rst = b; // this happens once at time zero // starts off as asserted at time zero #; // wait for time units rst = b; clk = b; // deassert the rst signal // this repeats forever // starts off as high at time zero #25; // wait for half period clk = b; // clock goes low #25; // wait for half period

case Statements in Verilog What does the following piece of code represent? always_comb begin case ( sel_i ) 2 d : z_o = a_i; 2 d : z_o = b_i; 2 d2 : z_o = c_i; 2 d3 : z_o = d_i; default : z_o = bx; endcase end endmodule always_comb implicitly assume a complete sensitivity list. It s the same as: always @(*) Useful for homework 3 9

Synchronous design: specify a clock When writing a module with a clock signal, use behavioral description with the clock in the sensitivity list always @(posedge clk) begin Useful for homework 3 // do stuff end

Generate a clock in a testbench When testing a module with multiple inputs, make sure you start from a known condition How to generate a clock signal in a testbench? initial begin end always // initialize your module inputs here #5 clk =! clk; Useful for homework 3

CSE4L: Components and Design Techniques for Digital Systems 2

Circuit Delay Transistors have instrinsic resistance and capacitance Signals take time to propagate from the input to the output of a gate Sometimes delays are labeled as @<delay_value> in circuit drawings 3

-Bit & Multi-bit Adders Half Adder A C out + S B C out Full Adder A + S B C in Types of multi-bit adders Ripple-carry (slow) Carry-lookahead (faster) Two-level logic adder (even faster) A B C out S = A B C out = AB S C in A B C out S C out Symbol A B N N + S N C in S = A B C in C out = AB + AC in + BC in

Ripple-Carry Adder Chain -bit adders together Carry ripples through entire chain Disadvantage: slow A 3 B 3 A 3 B 3 A B A B C out + C + 3 C 29 C + C + C in S 3 S 3 S S Ripple-carry adder delay t ripple = Nt FA where t FA is the delay of a full adder

Two-level Logic Adder No matter how many inputs you have, look at the truth table, convert to Kmap, apply the algorithm for two-level logic minimization Very fast adder, but. Beyond 8 inputs, a shockingly large amount of gates! Number of gates increases exponentially Ripple carry adder Carry-lookahead adder (next slide) FAST Two-level logic adder COMPLEX

Carry-lookahead adders c4 c3 c2 c c a3 a2 a a b3 b2 b b s3 s2 s s Carries First operand Second operand

Carry-lookahead adders Adder with propagate (P) and generate (G) outputs: Ci+ = Ai Bi + Ci (Ai xor Bi) Generate Propagate Ci+ = Gi + Ci Pi The carry at some level is equal to if either the generate signal is equal to one or if the propagate and the previous carry are both

Full-Adder Two scenarios (actually three) When would we always generate a carry-out based on the A i and B i inputs alone When would we always propagate the carry? When would we actually kill the carry (meaning there is guaranteed to be no carry-out)? a i b i C out Full Adder C in s i 9

Carry-Lookahead Adder Applying these equations for a 4-bit adder we can solve for the multiple carry-in bits: C = G + P C C 2 = G + P C = G + P (G + P C ) = G + P G + P P C C 3 = G 2 + P 2 C 2 = G 2 + P 2 G + P 2 P G + P 2 P P C C 4 = G 3 + P 3 C 3 = G 3 + P 3 G 2 + P 3 P 2 G + P 3 P 2 P G + P 3 P 2 P P C

Ref: Dan Earnst Carry-Lookahead Adder

Carry-Lookahead Adder 4 4 4 4 4 4 4 4 A[5-2]B[5-2] C2 4-bit Adder P G 4 A [-8] B[-8] C 4-bit Adder 8 P G 4 A[7-4] B[7-4] C 4-bit Adder 4 P G 4 A[3-] B[3-] C 4-bit Adder P G 4 S[5-2] S[-8] S[7-4] S[3-] P 3 G 3 C 3 P 2 G 2 C 2 P G C P G C C 6 C 4 Lookahead Carry Unit P3- G3- C 4 bit adders with internal carry look-ahead P and G logic Second level carry-lookahead unit creates the GROUP P and G signals

Carry-lookahead adders Example: 4-bit CLA adder c = G + P c c2 = G + P c c3 = G2 + P2 c2 c4 = G3 + P3 c3 Gi = ai bi Pi = ai xor bi generate propagate All G and P are immediately available, but c are not. So you need to make substitutions: c = G + P c c2 = G + P (G + P c) c3 = G2 + P2 c2 c4 = G3 + P3 c3 = G + PG + PPc = (derive at home) = (derive at home) 23