Verilog Descriptions of Digital Systems

Slides:



Advertisements
Similar presentations
Algorithmic State Machines SD192 Digital Systems Lecture notes July 16, 2004.
Advertisements

//HDL Example 4-10 // //Gate-level description of circuit of Fig. 4-2 module analysis (A,B,C,F1,F2); input.
Verilog.
Supplement on Verilog adder examples
Verilog Modules for Common Digital Functions
CPEN Digital System Design
ECE Synthesis & Verification - Lecture 2 1 ECE 667 Spring 2011 ECE 667 Spring 2011 Synthesis and Verification of Digital Circuits High-Level (Architectural)
Combinational Logic with Verilog Materials taken from: Digital Design and Computer Architecture by David and Sarah Harris & The Essentials of Computer.
SYEN 3330 Digital SystemsJung H. Kim Chapter SYEN 3330 Digital Systems Chapters 4 – Part3: Verilog – Part 1.
1 Brief Introduction to Verilog Weiping Shi. 2 What is Verilog? It is a hardware description language Originally designed to model and verify a design.
CSE-221 Digital Logic Design (DLD)
EDA 實作 Verilog Tutorial 國研院國家晶片系統設計中心 July 2005 陳正斌.
2-to-1 Multiplexer: if Statement Discussion D7.1 Example 4.
CSE241 R1 Verilog.1Kahng & Cichy, UCSD ©2003 CSE241 VLSI Digital Circuits Winter 2003 Recitation 1: Verilog Introduction.
ENEE 408C Lab Capstone Project: Digital System Design Spring 2005 Class Web Site: e408c.
VLSI Digital System Design Datapath Operations and Ripple-Carry Add.
Adders.
Part 2: DESIGN CIRCUIT. LOGIC CIRCUIT DESIGN x y z F F = x + y’z x y z F Truth Table Boolean Function.
Lecture # 12 University of Tehran
CS 105 Digital Logic Design
Calculator Lab Overview Note: Slides Updated 10/8/12
ECE 2372 Modern Digital System Design
Registers CPE 49 RMUTI KOTAT.
ADDERS Half Adders Recall that the basic rules of binary addition are as indicated below in Table 2-9. A circuit known as the half-adder carries out these.
Introduction Verilog is a HARDWARE DESCRIPTION LANGUAGE (HDL) A hardware description language is a language or means used to describe or model a digital.
Digital Logic Structures: Chapter 3 COMP 2610 Dr. James Money COMP
C ONTINUOUS A SSIGNMENTS. C OMBINATIONAL L OGIC C IRCUITS each output of a Combinational Logic Circuit  A function of the inputs - Mapping functions.
Final Project. System Overview Description of Inputs reset: When LOW, a power on reset is performed. mode: When LOW, NORMal mode selected When HIGH,
ARITHMETIC MICRO OPERATIONS
Universal college of engineering & technology. .By Harsh Patel)
1 Ethics of Computing MONT 113G, Spring 2012 Session 5 Binary Addition.
Logic and computers 2/6/12. Binary Arithmetic /6/ Only two digits: the bits 0 and 1 (Think: 0 = F, 1.
COMP541 Arithmetic Circuits
Hardware Description Languages Digital Logic Design Instructor: Kasım Sinan YILDIRIM.
Digital Electronics Tutorial: Number System & Arithmetic Circuits Solutions.
ECE 320 Homework #4 1. Using 8 data input selector logic (MUX), implement the following two functions: a) F(A,B,C)=S 0 S 2 S 3 S 5 b) F(A,B,C,D)=P 0 +P.
Multiplexers Section Topics Multiplexers – Definition – Examples – Verilog Modeling.
ECE/CS 352 Digital System Fundamentals© T. Kaminski & C. Kime 1 ECE/CS 352 Digital Systems Fundamentals Fall 2000 Chapter 5 – Part 2 Tom Kaminski & Charles.
SYEN 3330 Digital SystemsJung H. Kim 1 SYEN 3330 Digital Systems Chapter 7 – Part 2.
EEE2243 Digital System Design Chapter 7: RTL Design by Muhazam Mustapha, March 2011.
How does a Computer Add ? Logic Gates within chips: AND Gate A B Output OR Gate A B Output A B A B
Electrical Engineering Engineering the Future Digital Circuits Fundamentals Hands-on Full-Adder Simulation (afternoon)
SERIAL MULTIPLIER Part 1
Supplement on Verilog for Algorithm State Machine Chart
Designing Combinational Logic Circuits in Verilog - 1
KARTHIK.S Lecturer/ECE S.N.G.C.E
Supplement on Verilog Sequential circuit examples: FSM
EKT 221 : Digital 2 Serial Transfers & Microoperations
Reference: Moris Mano 4th Edition Chapter 4
Principles & Applications
Digital System Design Review.
Chapter 4 Combinational Logic
Combinational Circuits
Instructor: Alexander Stoytchev
Week 7: Gates and Circuits: PART II
Number Systems and Circuits for Addition
Adders and Subtractors
FIGURE 1: SERIAL ADDER BLOCK DIAGRAM
Supplement on Verilog Sequential circuit examples: FSM
Register-Transfer Level Components in Verilog
The Verilog Hardware Description Language
XOR Function Logic Symbol  Description  Truth Table 
Instructor: Alexander Stoytchev
Design of Digital Circuits Lab 5 Supplement: Implementing an ALU
Prof. Onur Mutlu ETH Zurich Spring March 2019
Adder Circuits By: Asst Lec. Basma Nazar
Half & Full Subtractor Half Subtractor Full Subtractor.
Half & Full Subtractor Half Subtractor Full Subtractor.
Instructor: Alexander Stoytchev
Computer Architecture
Presentation transcript:

Verilog Descriptions of Digital Systems

Design Flow

Verilog Lab #3   Design a serial adder circuit using Verilog.  The circuit should add two 8-bit numbers, A and B.  The result should be stored back into the A register.  Use the diagram below to guide you.  Hint:  Write one module to describe the datapath and a second module to describe the control.  Annotate your simvision trace output to demonstrate that the adder works correctly.  Demonstrate by adding $45 to $10 in your testbench.

Serial Adder Data Path pinB

Adder/Subtractor // 4-bit full-adder (behavioral) module fa(sum, co, a, b, ci) ; input [3:0] a, b ; input ci ; output [3:0] sum ; output co ; assign {co, sum} = a + (ci ? ~b : b) + ci ; endmodule

Serial Adder Control Logic pinB T0: if (!start) goto T0 T1: if (start) goto T1 T2: if (clrA) A <= 0, B <= pinB, C <= 0 T3: A <= shr(A), B <= shr(B) T4: A <= shr(A), B <= shr(B) T5: A <= shr(A), B <= shr(B) T6: A <= shr(A), B <= shr(B), goto T0

Controller and Datapath Modules pinB module serial_adder_datapath(sum, sout, pinB, ctl, reset, clk) ; output [7:0] sum ; output sout ; input sinB ; input [ ] ctl ; input reset, clk ; endmodule module serial_adder_control(ctl, busy, start, clrA, reset, inv_clk) ; output [ ] ctl ; output busy ; input reset, start, inv_clk ;

Three Techniques for Building Control Units Classical FSM One-Hot Decode a Counter T0: if (!start) goto T0 T1: if (start) goto T1 T2: if (clrA) A <= 0, B <= pinB, C <= 0 T3: A <= shr(A), B <= shr(B) T4: A <= shr(A), B <= shr(B) T5: A <= shr(A), B <= shr(B) T6: A <= shr(A), B <= shr(B), goto T0

Binary Multiplication

Binary Multiplier

ASM Chart

Numerical Example

Serial Multiplier (Verilog) module multiplier(S, clk, clr, Bin, Qin, C, A, Q, P) ; input S, clk, clr ; input [4:0] Bin, Qin ; output C ; output [4:0] A, Q ; output [2:0] P ; // system registers reg C ; reg [4:0] A, Q, B ; reg [2:0] P ; reg [1:0] pstate, nstate ; parameter T0 = 2'b00, T1= 2'b01, T2 = 2'b10, T3 = 2'b11 ; // combinational circuit wire Z ; assign Z = ~|P ; // state register process for controller always @(negedge clk or negedge clr) begin if (~clr) pstate <= T0 ; else pstate <= nstate ; end

Serial Multiplier (Continued) // state transition process for controller always @(S or Z or pstate) begin case (pstate) T0: if (S) nstate = T1; else nstate = T0 ; T1: nstate = T2 ; T2: nstate = T3 ; T3: if (Z) nstate = T0; else nstate = T2 ; endcase end // register transfer operations always @(posedge clk) begin T0: B <= Bin ; T1: begin A <= 0 ; C <= 1 ; P <= 5 ; Q <= Qin ; T2: begin P <= P - 1 ; if (Q[0]) {C,A} <= A + B ; T3: begin C <= 0 ; A <= {C, A[4:1]} ; Q <= {A[0], Q{4:1]} ; endmodule

Serial Multiplier (Testbench) module multiplier_tb; reg S, clk, clr ; reg [4:0] Bin, Qin ; wire C ; wire [4:0] A, Q ; wire [2:0] P ; // instantiate multiplier multiplier uut(S, clk, clr, Bin, Qin, C, A, Q, P); // generate test vectors initial begin #0 begin S = 0; clk = 0; clr = 0 ; end #5 begin S = 1; clr = 1; Bin = 5'b10111 ; Qin = 5'b10011 ; #15 begin S = 0 ;

Serial Multiplier (Testbench, continued) // create dumpfile and generate clock initial begin $dumpfile("./multiplier.dmp") ; $dumpflush ; $dumpvars(2, multiplier_tb) ; repeat (26) #5 clk = ~clk ; end endmodule