L26 – Datapath ALU implementation

Slides:



Advertisements
Similar presentations
L23 – Adder Architectures. Adders  Carry Lookahead adder  Carry select adder (staged)  Carry Multiplexed Adder  Ref: text Unit 15 9/2/2012 – ECE 3561.
Advertisements

L18 – VHDL for other counters and controllers. Other counters  More examples Gray Code counter Controlled counters  Up down counter  Ref: text Unit.
Quad 2-to-1 and Quad 4-to-1 Multiplexers Discussion D2.4 Example 7.
1 VLSI DESIGN USING VHDL Part II A workshop by Dr. Junaid Ahmed Zubairi.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
George Mason University ECE 448 – FPGA and ASIC Design with VHDL Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448.
ECE 331 – Digital System Design
CSET 4650 Field Programmable Logic Devices Dan Solarek VHDL Behavioral & Structural.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Binary additon & subtraction.
9/15/09 - L25 Registers & Load Enable Copyright Joanne DeGroat, ECE, OSU1 Registers & Load Enable.
L23 – Arithmetic Logic Units. Arithmetic Logic Units (ALU)  Modern ALU design  ALU is heart of datapath  Ref: text Unit 15 9/2/2012 – ECE 3561 Lect.
Data Flow Modeling of Combinational Logic Simple Testbenches
Digital Arithmetic and Arithmetic Circuits
Figure 5.1 Conversion from decimal to binary. Table 5.1 Numbers in different systems.
L16 – Testbenches for state machines. VHDL Language Elements  More examples HDL coding of class examples Testbench for example  Testing of examples.
CprE / ComS 583 Reconfigurable Computing Prof. Joseph Zambreno Department of Electrical and Computer Engineering Iowa State University Lecture #17 – Introduction.
A VHDL Tutorial ENG2410. ENG241/VHDL Tutorial2 Goals Introduce the students to the following: –VHDL as Hardware description language. –How to describe.
1/8/ L3 Data Path DesignCopyright Joanne DeGroat, ECE, OSU1 ALUs and Data Paths Subtitle: How to design the data path of a processor.
1 Part I: SYSTEM DESIGN. 2 Packages and Components Functions and Procedures Problem (Design & Implementation) Additional System Designs.
1/8/ L11 Project Step 5Copyright Joanne DeGroat, ECE, OSU1 Project Step 5 Step 2 in behavioral modeling. Use of procedures.
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
L16 – VHDL for State Machines with binary encoding.
1/8/ L7 Project Step 3Copyright Joanne DeGroat, ECE, OSU1 Project Step 3 Structural Modeling and the Generate Statement.
L12 – VHDL Overview. VHDL Overview  HDL history and background  HDL CAD systems  HDL view of design  Low level HDL examples  Ref: text Unit 10, 17,
9/15/09 - L15 Decoders, Multiplexers Copyright Joanne DeGroat, ECE, OSU1 Decoders and Multiplexer Circuits.
ECE 332 Digital Electronics and Logic Design Lab Lab 6 Concurrent Statements & Adders.
1/8/ Data Path Design & Control Copyright Joanne DeGroat, ECE, OSU1 Processor Data Paths - ALU and Registers Incorporating the ALU into a.
ECE 331 – Digital System Design Multiplexers and Demultiplexers (Lecture #13)
(1) Basic Language Concepts © Sudhakar Yalamanchili, Georgia Institute of Technology, 2006.
1/8/ Extra CreditCopyright Joanne DeGroat, ECE, OSU1 PS3xcr Extra Credit Project Modification that can be done to the datapath.
1/8/ L2 VHDL Introcution© Copyright Joanne DeGroat, ECE, OSU1 Introduction to VHDL.
L19 – Resolved Signals. Resolved Signals  What are resolved signals In systems In VHDL Resolution – Isn’t that for resolving conflicts?  Ref: text Unit.
Data Flow Modeling in VHDL
L20 – Register Set. The 430 Register Set  Not exactly a dual ported register set, but a dual drive register set.  Ref: text Unit 10, 17, 20 9/2/2012.
Project 1.  Two parts Implement a 3 bit Gray Code Counter Implement a 4-to-1 muxtiplexer  Can be done on Altera (Quartis) or Xilinx 8/22/2012 – ECE.
1/8/ L25 Floating Point Adder Copyright Joanne DeGroat, ECE, OSU1 IEEE Floating Point Adder Using the IEEE Floating Point Standard for an.
George Mason University Data Flow Modeling of Combinational Logic ECE 545 Lecture 5.
Explain Half Adder and Full Adder with Truth Table.
Data Flow and Behavioral Modeling in VHDL 1 MS EMBEDDED SYSTEMS.
1/8/ L11 Project Step 5Copyright Joanne DeGroat, ECE, OSU1 Project Step 6 Step 3 in behavioral modeling. Use of packages.
MicroBaby ALU.
1 Computer Architecture & Assembly Language Spring 2009 Dr. Richard Spillman Lecture 11 – ALU Design.
Combinational logic circuit
Combinational Circuits
Subtitle: How to design the data path of a processor.
ENG6530 Reconfigurable Computing Systems
L19 – Register Set.
ECE 448 Lecture 3 Combinational-Circuit Building Blocks Data Flow Modeling of Combinational Logic ECE 448 – FPGA and ASIC Design with VHDL.
VHDL (VHSIC Hardware Description Language)
Incrementing and Decrementing
Concurrent vs Sequential
MicroBaby Datapath.
Copyright Joanne DeGroat, ECE, OSU
Chapter 5 – Number Representation and Arithmetic Circuits
L21 – Register Set.
L25 – Datapath ALU.
MicroBaby Datapath.
Copyright Joanne DeGroat, ECE, OSU
L22 – Register Set Debugging
Data Flow Description of Combinational-Circuit Building Blocks
Step 2 in behavioral modeling. Use of procedures.
Figure 8.1. The general form of a sequential circuit.
Data Flow Description of Combinational-Circuit Building Blocks
Combinational Circuits
Copyright Joanne DeGroat, ECE, OSU
Step 3 in behavioral modeling. Use of packages.
© Copyright Joanne DeGroat, ECE, OSU
L25 – Final Review AU 15 Final Exam – Classroom – Journalism 300
CprE / ComS 583 Reconfigurable Computing
Digital Logic with VHDL
Presentation transcript:

L26 – Datapath ALU implementation

Copyright 2012 - Joanne DeGroat, ECE, OSU Datapath ALU The full ALU Incorporating ALU into datapath From Datapath to microprocessor Ref: text and basic computer architecture books 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU The full ALU ALU does both arithmetic and logic operations. For the logic operations use a 4-to-1 multiplexer and ALU can do any logic operation on two bits. Arithmetic operations are add (no carry), add with carry, subtract (2’s complement), subtract with borrow, increment, and decrement. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU The structure The internal ALU structure 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Incorporating into datapath Take ALU component, add input registers and output bus driver 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

How to approach this in quartis Have the register set. Build up the ALU unit But how to build up the ALU unit? Assignment HW 12 – Create the core of the ALU unit – an add unit, a logic unit (4-to-1 mux), the 2-to-1 Mux for selecting the output from which unit, and the internal controller. Note that there will be several interface signals to the units. MUX – the function control signals (4), A, B Adder – A,B, the carry in OUTPUT Mux – L, R, select 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU Assignment HW12 Create the blocks Create the core unit Synthesize it in Quartis 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU Assignment HW 13 Complete the ALU unit. Add the remaining internal muxes and internal control unit that given the operation input, generates the internal control signals. Note that for an increment it is easy to simply add one to the A input. For decrement add FF (-1) to the A input. (3-1=2 : 0011+1111=0010, 6-1 : 0110+1111=0101) Once this is complete and synthesizes OK, add input registers and an output driver to give the unit shown in the datapath. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU Assignment 14 This is the final assignment Integrate the ALU with the register to form a datapath. Synthesize it to synthesize a complete datapath. Write a report that includes the HDL code, the RTL diagram from synthesis, and the basic synthesis statistics. Simulate it to load values into the register. You will need to simulate two logic operations, an add, an increment, and a decrement. For these show the simulation cycle where the data is sent to the ALU and the simulation cycle where the result is returned to the register. Be sure the show the busses, and the control signals on the simulation waveform and explain them in the text of the report. 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Start to put the unit together The Units 4-to-1 Mux ENTITY mux4to1 IS PORT (G3,G2,G1,G0,S1,S0 : in bit; R : OUT bit); END mux4to1; ARCHITECTURE one OF mux4to1 IS BEGIN R <= (G0 AND NOT S1 AND NOT S0) OR (G1 AND NOT S1 AND S0) OR (G2 AND S1 AND NOT S0) OR (G3 AND S1 AND S0); END one; 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU An 4-to-1 mux by 8-bits Create an 8 bit wide version ENTITY mux4to1x8 IS PORT (G3,G2,G1,G0 : IN bit; a : IN bit_vector (7 downto 0); b : IN bit_vector (7 downto 0); r : OUT bit_vector (7 downto 0)); END mux4to1x8; ARCHITECTURE one OF mux4to1x8 IS COMPONENT mux4to1 PORT (G3,G2,G1,G0,S1,S0 : in bit; R : OUT bit); END COMPONENT; FOR all : mux4to1 USE ENTITY work.mux4to1(one); BEGIN u0 : mux4to1 PORT MAP (G3,G2,G1,G0,a(0),b(0),r(0)); u1 : mux4to1 PORT MAP (G3,G2,G1,G0,a(1),b(1),r(1)); u2 : mux4to1 PORT MAP (G3,G2,G1,G0,a(2),b(2),r(2)); u3 : mux4to1 PORT MAP (G3,G2,G1,G0,a(3),b(3),r(3)); u4 : mux4to1 PORT MAP (G3,G2,G1,G0,a(4),b(4),r(4)); u5 : mux4to1 PORT MAP (G3,G2,G1,G0,a(5),b(5),r(5)); u6 : mux4to1 PORT MAP (G3,G2,G1,G0,a(6),b(6),r(6)); u7 : mux4to1 PORT MAP (G3,G2,G1,G0,a(7),b(7),r(7)); END one; 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU What now? Already have a 2 to 1 x 8-bit mux. LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; ENTITY mux2to1x8 IS PORT (linput,rinput : IN std_logic_vector(7 downto 0); sel : IN std_logic; dataout : OUT std_logic_vector(7 downto 0)); END mux2to1x8; ARCHITECTURE one OF mux2to1x8 IS BEGIN dataout <= linput WHEN sel='1' ELSE rinput; END one; 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU Create an 8 bit adder Simple a ripple carry adder. Start with a full adder LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; ENTITY full_add IS PORT (A,B,Cin : IN std_logic; Sum,Cout : OUT std_logic); END full_add; ARCHITECTURE one OF full_add IS BEGIN Sum <= A XOR B XOR Cin; Cout <= (A AND B) OR (A AND Cin) OR (B AND Cin); END one; 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU An 8-bit adder LIBRARY IEEE; USE IEEE.STD_LOGIC_1164.all; ENTITY add8 IS PORT (A,B : IN std_logic_vector (7 downto 0); Cin : IN std_logic; Cout : OUT std_logic; Sum : OUT std_logic_vector (7 downto 0)); END add8; ARCHITECTURE one OF add8 IS COMPONENT full_add IS PORT (A,B,Cin : IN std_logic; Sum,Cout : OUT std_logic); END COMPONENT; FOR all : full_add USE ENTITY work.full_add(one); SIGNAL ic : std_logic_vector (6 downto 0); BEGIN a0 : full_add PORT MAP (A(0),B(0),Cin,Sum(0),ic(0)); a1 : full_add PORT MAP (A(1),B(1),ic(0),Sum(1),ic(1)); a2 : full_add PORT MAP (A(2),B(2),ic(1),Sum(2),ic(2)); a3 : full_add PORT MAP (A(3),B(3),ic(2),Sum(3),ic(3)); a4 : full_add PORT MAP (A(4),B(4),ic(3),Sum(4),ic(4)); a5 : full_add PORT MAP (A(5),B(5),ic(4),Sum(5),ic(5)); a6 : full_add PORT MAP (A(6),B(6),ic(5),Sum(6),ic(6)); a7 : full_add PORT MAP (A(7),B(7),ic(6),Sum(7),Cout); END one; 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU The decoder Step 1 – select encoding 4 input bit for operation - oper (3 downto 0) 0000 - add 0001 - add with carry 0010 - subtract 0011 - subtract with carry 0100 - increment 0110 - decrement 1000 - and 1001 - or 1010 - xor 1011 - not A 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU The muxes Output mux Control is oper(3) = 1 – select logic 0 - select adder Carry in mux Control is oper(0) = 0 – select the 0 side 1 – select the cin side B input or fixed val for increment/decrement Control is oper(2) = 0 – select B input 1 – select fixed val Fixed value mux Control is oper(1) = 0 – select increment side $01 1 – select decrement side (-1) $FF 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

For logic operation generate Gs 1000 - and Want G(3 dt 0) = 1000 1001 - or Want G(3 dt 0) =1110 1010 - xor Want 0110 1011 - not A Want 0011 Use logic equations to generate the Gs. Can treat the coding for arithmetic operation as don’t cares on K maps - example 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Copyright 2012 - Joanne DeGroat, ECE, OSU Final step Create entity for ALU unit ENTITY alu IS PORT (a,b : IN bit_vector (7 downto 0); cin : IN bit; oper : IN bit_vector (3 downto 0); result : OUT bit_vector(7 downto 0)); END alu; 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU

Then create the architecture This is the assignment. Questions??? 9/2/2012 – ECE 3561 Lect 9 Copyright 2012 - Joanne DeGroat, ECE, OSU