Arithmetic Logic Unit (ALU) Lecture L9.3 Lab 10. ALU CB = carry_borrow flag Z = zero flag (Z = 1 if Y = 0)

Slides:



Advertisements
Similar presentations
Adders Module M8.1 Section 6.2. Adders Half Adder Full Adder TTL Adder.
Advertisements

Modulo-N Counters Module M10.4 Section 7.2.
Encoders Module M9.3 Section 6.3. Encoders Priority Encoders TTL Encoders.
Demultiplexers Module M6.4 Section 6.4. Demultiplexers YIN 1 x 4 DeMUX d0d1 Y0 Y1 Y2 Y3 Y0 Y1 Y2 Y3 d1d0 0 0 YIN YIN YIN
Shift Registers Module M11.1 Section 7.3.
7-Segment Displays Lecture L6.1 Section 6.3. Turning on an LED.
//HDL Example 6-1 // //Behavioral description of //Universal shift register // Fig. 6-7 and Table 6-3 module shftreg.
Binary Counters Module M10.3 Section 7.2. Counters 3-Bit Up Counter 3-Bit Down Counter Up-Down Counter.
7-Segment Displays Lecture L6.7 Section 6.5. Turning on an LED.
Binary-to-BCD Converter Lecture L6.2 Section 6.5 pp
Using State Machines as Control Circuits Lecture L9.4.
Multiplier Lecture L7.3 Section 10.4 (p.276) Section 7.3 (Handout)
Multiplexers Lecture L6.4 Section 6.4.
Subtractors Module M8.2 Section 6.2. Subtractors Half Subtractor Full Subtractor Adder/Subtractor - 1 Adder/Subtractor - 2.
Designing State Machines Lecture L9.2 Handout Section 9.2.
Datapaths Lecture L10.2 Sections 10.2, ALU (Sect. 7.5 and Lab 6)
Arbitrary Waveforms Lecture L8.5 Section 7.2. CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s3 0 1.
Counters as State Machines Lecture L9.1 Handout Section 9.1.
Designing State Machines SQRT controller Lecture L9.2a Section 9.2.
Equality Detector Lecture L6.1 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
Flip-Flops Module M10.2 Section 7.1. D Latch Q !Q CLK D !S !R S R X 0 Q 0 !Q 0 D CLK Q !Q Note that Q follows D when the clock in high, and.
Binary Counters Lecture L8.3 Section 8.2. Counters 3-Bit Up Counter 3-Bit Down Counter Up-Down Counter.
Shifter Lecture L7.4 Group HW #4 Section 10.3.
Modulo-N Counters Lecture L8.4 Section 7.2. Counters Modulo-5 Counter 3-Bit Down Counter with Load and Timeout Modulo-N Down Counter.
NDG-L38Introduction to ASIC Design1 Design of a Simple Customizable Microprocessor * Chapter 7 and 15, “Digital System Design and Prototyping”  SIMP.
Codes and Code Converters
Code Converters Module M7.1 Section 6.5. Code Converters Binary-to-BCD Converters ABEL TRUTH_TABLE Command.
Arbitrary Waveforms Module M10.5 Section 7.2. CLK DQ !Q CLK DQ !Q CLK DQ !Q Q0Q0.D Q1 Q2 Q1.D Q2.D s s s s3 0 1.
Arithmetic Logic Unit (ALU) Lecture L7.5 Section 7.5.
Pulse-Width Modulated DAC Lecture 11.3 Section 11.5.
Multiplexers Module M6.1 Section 6.4. Multiplexers A 4-to-1 MUX TTL Multiplexer A 2-to-1 MUX.
2’s Complement 4-Bit Saturator
Adders Lecture L7.1 Section 6.2 Section 10.4 (pp )
Shifters Lecture L7.4 Section 7.4. MODULE shift TITLE 'shifter' DECLARATIONS " INPUT PINS " D3..D0 PIN 11,7,6,5; D = [D3..D0]; s2..s0 PIN 3,2,1; S.
Flip-Flops Lecture L8.2 Section 8.1. Recall the !S-!R Latch !S !R Q !Q !S !R Q !Q X Y nand 1 0 Set 1 0.
Decoders Module M9.1 Section 6.3. Decoders TTL Decoders.
Shift Registers Lecture L6.6 Section Bit Shift Register.
Equality Detector Lecture L6.3 Section 6.1. Equality Detector XNOR X Y Z Z = !(X $ Y) X Y Z
7-Segment Displays Module M7.2 Section 6.5. Turning on an LED Common Anode.
Homework Reading Machine Projects Labs
Flip-Flops Lecture L8.2 Section 7.1 – Book Sect. 8.1– Handout.
Digital Logic Review Discussion D8.7.
CS 140L Lecture 4 Professor CK Cheng 10/22/02. 1)F-F 2)Shift register 3)Counter (Asynchronous) 4)Counter (Synchronous)
Computer System Configuration and Function Computer Architecture and Design Lecture 6.
SAP1 (Simple-As-Possible) Computer
Lab 6 Module M8.3. EXPERIMENT 6: Adder/Subtractor PRE-LAB 1.Read and understand text Sec. 6.2, Adders and Subtractors, pages Using textbook.
Princess Sumaya Univ. Computer Engineering Dept. Chapter 6:
Department of Communication Engineering, NCTU 1 Unit 2 Reviews on Logic Elements.
Review of Digital Logic Design Concepts OR: What I Need to Know from Digital Logic Design (EEL3705)
A Greatest Common Divisor (GCD) Processor Lecture L10.3 Sections 10.4, 10.5.
Digital Electronics.
EE121 John Wakerly Lecture #9
Verilog hdl – II.
Logiske funktioner i Peel. PEEL 18CV8 logic diagram.
Digital Logic & Design Dr. Waseem Ikram Lecture No. 35.
Implementing Combinational
REGISTER TRANSFER AND MICROOPERATIONS
Homework Reading Machine Projects Labs
Basics of digital systems
Counters as State Machines
Using a State Machine to Design a Sequence Detector
Shift Registers Lecture L8.6 Section 8.3.
Designing Digital Circuits Using Hardware Description Languages (HDLs)
Analog-to-Digital Converters
Homework Reading Machine Projects Labs
A register design with parallel load input
Digital Logic & Design Dr. Waseem Ikram Lecture No. 36.
Switching Theory and Logic Design Chapter 5:
Magnitude Comparator Lecture L6.2 Section 6.1.
CS 140L Lecture 8 Professor CK Cheng 11/19/02.
Presentation transcript:

Arithmetic Logic Unit (ALU) Lecture L9.3 Lab 10

ALU CB = carry_borrow flag Z = zero flag (Z = 1 if Y = 0)

MODULE alu interface([A3..A0],[B3..B0], [s2..s0] -> [Y3..Y0],CB,Z); TITLE '_____________________, _____________________, ___/___/03' DECLARATIONS " INPUT PINS " A3..A0 PIN; A = [A3..A0]; " 4-bit input A B3..B0 PIN; B = [B3..B0]; " 4-bit input B s2..s0 PIN; S = [s2..s0];" 3-bit control input " OUTPUT PINS " Y3..Y0 PIN; Y = [Y3..Y0]; " 4-bit output Y CB, Z PIN ISTYPE 'com';

" INTERMEDIATE NODES " C4..C0 NODE ISTYPE 'com'; " internal carry vector Cin = [C3..C0]; " carry input vector Cout = [C4..C1]; " carry output vector " DEFINITIONS " E = !s2 & !s1 & s0;" E = 1 for subtraction. Bin = B $ E; not = !A;" NOT A and = A & B;" A AND B or = _____;" A OR B xorr = ______;" A XOR B SD = A $ Bin $ Cin; " sum/difference (A + B, A - B)

EQUATIONS C0 = E; " E => CB0; (NOT B + CB0) = 2's complement of B. Cout = _______________________; " carry/borrow output vector CB = ___;" output carry/borrow Z = !Y3 & !Y2 & !Y1 & !Y0;" Z = 1 if Y = 0 when (S == 0) then Y = SD; " A + B when (S == 1) then Y = ___;" A - B when (S == 2) then Y = A;" A when (S == 3) then Y = ___;" B when (S == 4) then Y = not;" NOT when (S == 5) then Y = ___;" AND when (S == 6) then Y = ___;" OR when (S == 7) then Y = ___;" XOR END alu

Lab 10

A 1-Bit Register

A 4-Bit Register

MODULE reg4bit interface([D3..D0],clr,clk,load -> [Q3..Q0]); TITLE '_____________________, _____________________, ___/___/03' DECLARATIONS " INPUT PINS " clk PIN; " clock load PIN; clr PIN;" asynchronous clear D3..D0 PIN;" 4-bit input D = [D3..D0]; " OUTPUT PINS " Q3..Q0 PIN ISTYPE 'reg buffer'; " 4-bit output Q = [Q3..Q0]; " 4-bit reg output vector EQUATIONS Q.C = clk; Q.AR = clr; Q.D = ______________________; END

Lab 10

MODULE lab10 TITLE '____________________, ___________________, ___/___/03' DECLARATIONS hex7seg interface([D3..D0] -> [a,b,c,d,e,f,g]); d7L FUNCTIONAL_BLOCK hex7seg; d7R FUNCTIONAL_BLOCK hex7seg; alu interface([A3..A0],[B3..B0], [s2..s0] -> [Y3..Y0],CB,Z); alu1 FUNCTIONAL_BLOCK alu; reg4bit interface([D3..D0],clr,clk,load -> [Q3..Q0]); W FUNCTIONAL_BLOCK reg4bit; status FUNCTIONAL_BLOCK reg4bit;

" INPUT PINS " clk PIN 74;" clock clr PIN 70;" clear PA3..PA0 PIN 11,7,6,5;" Left Switches S ; PA = [PA3..PA0]; alusel2..alusel0 PIN 3,2,1;" alu select alusel = [alusel2..alusel0];

" OUTPUT PINS " C, Z PIN 35,36 ISTYPE 'com'; " carry and zero flags PD3..PD0 NODE ISTYPE 'reg'; " 4-bit reg output PD = [PD3..PD0]; PW3..PW0 NODE ISTYPE 'reg'; " 4-bit reg output PW = [PW3..PW0]; LD3..LD0 PIN 40,41,43,44 ISTYPE 'reg'; " leds LD = [LD3..LD0]; [a,b,c,d,e,f,g] PIN 57,58,61,62,63,65,66 ISTYPE 'com'; "Leftmost (tens) 7-segment LED display [aa,bb,cc,dd,ee,ff,gg] PIN 15,18,23,21,19,14,17 ISTYPE 'com'; " Rightmost (units) 7-segment LED display

EQUATIONS W.load = 1; W.clr = clr; W.clk = clk; W.[D3..D0] = _____________; status.load = 1; status.clr = clr; status.clk = clk; status.D0 = alu1.CB; status.D1 = alu1.Z; alu1.[A3..A0] = _____; alu1.[B3..B0] = _____________; alu1.[s2..s0] = [alusel2..alusel0];

C = status.Q0; Z = status.Q1; PD = PA; PW = W.[Q3..Q0]; LD = alu1.[Y3..Y0]; [a,b,c,d,e,f,g] = d7L.[a,b,c,d,e,f,g]; d7L.[D3..D0] = PD; [aa,bb,cc,dd,ee,ff,gg] = d7R.[a,b,c,d,e,f,g]; d7R.[D3..D0] = PW;

@radix 16; test_vectors([clk,alusel,PA] -> [PW,C,Z]) [.C.,0,7] -> [__,__,__]; [.C.,0,5] -> [__,__,__]; [.C.,1,6] -> [__,__,__]; [.C.,2,4] -> [__,__,__]; [.C.,3,3] -> [__,__,__]; [.C.,4,0A] -> [__,__,__]; [.C.,5,0C] -> [__,__,__]; [.C.,6,2] -> [__,__,__]; [.C.,7,0C] -> [__,__,__]; [.C.,0,6] -> [__,__,__]; END lab10