CHAPTER NINE - MSI Logic Circuits

Similar documents
Chapter 6 Combinational-Circuit Building Blocks

UNIT- V COMBINATIONAL LOGIC DESIGN

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two Solutions 26 February 2014

LABORATORY MANUAL VLSI DESIGN LAB EE-330-F

ECE 545 Lecture 8. Data Flow Description of Combinational-Circuit Building Blocks. George Mason University

ECE 2020B Fundamentals of Digital Design Spring problems, 6 pages Exam Two 26 February 2014

1 MALP ( ) Unit-1. (1) Draw and explain the internal architecture of 8085.

3. The high voltage level of a digital signal in positive logic is : a) 1 b) 0 c) either 1 or 0

Principles of Digital Techniques PDT (17320) Assignment No State advantages of digital system over analog system.

BUILDING BLOCKS OF A BASIC MICROPROCESSOR. Part 1 PowerPoint Format of Lecture 3 of Book

END-TERM EXAMINATION

ELCT 501: Digital System Design

Code No: R Set No. 1

Scheme G. Sample Test Paper-I

Microcomputers. Outline. Number Systems and Digital Logic Review

Lab 3: Standard Combinational Components

Introduction to VHDL #1

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

ECE 448 Lecture 3. Combinational-Circuit Building Blocks. Data Flow Modeling of Combinational Logic

EECS 270 Midterm Exam

COMBINATIONAL LOGIC CIRCUITS

Combinational Logic with MSI and LSI

Hours / 100 Marks Seat No.

Written exam for IE1204/5 Digital Design Thursday 29/

IE1204 Digital Design L7: Combinational circuits, Introduction to VHDL

SRI SUKHMANI INSTITUTE OF ENGINEERING AND TECHNOLOGY, DERA BASSI (MOHALI)

D I G I T A L C I R C U I T S E E

CHAPTER TWELVE - Memory Devices

Experiment 9: Binary Arithmetic Circuits. In-Lab Procedure and Report (30 points)

Ripple Counters. Lecture 30 1

VALLIAMMAI ENGINEERING COLLEGE. SRM Nagar, Kattankulathur DEPARTMENT OF ELECTRONICS AND COMMUNICATION ENGINEERING EC6302 DIGITAL ELECTRONICS

1. Mark the correct statement(s)

Combinational Circuits

10EC33: DIGITAL ELECTRONICS QUESTION BANK

Module -10. Encoder. Table of Contents

Logic design Ibn Al Haitham collage /Computer science Eng. Sameer

B.Tech II Year I Semester (R13) Regular Examinations December 2014 DIGITAL LOGIC DESIGN

Chapter Three. Digital Components

Contents. Chapter 9 Datapaths Page 1 of 28

Lecture 1: VHDL Quick Start. Digital Systems Design. Fall 10, Dec 17 Lecture 1 1

EE 109L Review. Name: Solutions

Code No: R Set No. 1

ECE 2030B 1:00pm Computer Engineering Spring problems, 5 pages Exam Two 10 March 2010

Lecture-9 Intel 8085 Microprocessor It is a 40-pin DIP(Dual in package) chip, base on NMOS technology, on a single chip of silicon.

Logic and Computer Design Fundamentals VHDL. Part 1 Chapter 4 Basics and Constructs

!"#$%&&"'(')"*+"%,%-".#"'/"'.001$$"

REGISTER TRANSFER LANGUAGE

DIGITAL LOGIC WITH VHDL (Fall 2013) Unit 2

Injntu.com Injntu.com Injntu.com R16

Project 17 Shift Register 8-Bit Binary Counter

DHANALAKSHMI SRINIVASAN COLLEGE OF ENGINEERING AND TECHNOLOGY

R10. II B. Tech I Semester, Supplementary Examinations, May

Chapter 4: Combinational Logic

HANSABA COLLEGE OF ENGINEERING & TECHNOLOGY (098) SUBJECT: DIGITAL ELECTRONICS ( ) Assignment

Department of Electronics & Communication Engineering Lab Manual E-CAD Lab

8254 is a programmable interval timer. Which is widely used in clock driven digital circuits. with out timer there will not be proper synchronization

a, b sum module add32 sum vector bus sum[31:0] sum[0] sum[31]. sum[7:0] sum sum overflow module add32_carry assign

Code No: R Set No. 1

Chapter 2 Basic Logic Circuits and VHDL Description

This tutorial gives a complete understanding on Computer Logical Organization starting from basic computer overview till its advanced architecture.

Digital Fundamentals

Abi Farsoni, Department of Nuclear Engineering and Radiation Health Physics, Oregon State University

Hardware Description Language VHDL (1) Introduction

1. What is y-chart? ans: The y- chart consists of three domains:- behavioral, structural and geometrical.

VHDL Examples Mohamed Zaky

VHDL: RTL Synthesis Basics. 1 of 59

UNIT-III REGISTER TRANSFER LANGUAGE AND DESIGN OF CONTROL UNIT

Lecture 21: Combinational Circuits. Integrated Circuits. Integrated Circuits, cont. Integrated Circuits Combinational Circuits

VHDL Structural Modeling II

DIGITAL ARITHMETIC: OPERATIONS AND CIRCUITS

1. Prove that if you have tri-state buffers and inverters, you can build any combinational logic circuit. [4]

Lattice VHDL Training

Solutions - Homework 4 (Due date: November 9:30 am) Presentation and clarity are very important!

CSCI Lab 3. VHDL Syntax. Due: Tuesday, week6 Submit to: \\fs2\csci250\lab-3\

R07

Question Total Possible Test Score Total 100

(ii) Simplify and implement the following SOP function using NOR gates:

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

Hours / 100 Marks Seat No.

Contents. Chapter 3 Combinational Circuits Page 1 of 34

1. INTRODUCTION TO MICROPROCESSOR AND MICROCOMPUTER ARCHITECTURE:

COMPUTER ARCHITECTURE AND ORGANIZATION Register Transfer and Micro-operations 1. Introduction A digital system is an interconnection of digital

CONTENTS CHAPTER 1: NUMBER SYSTEM. Foreword...(vii) Preface... (ix) Acknowledgement... (xi) About the Author...(xxiii)

Combinational Logic. Prof. Wangrok Oh. Dept. of Information Communications Eng. Chungnam National University. Prof. Wangrok Oh(CNU) 1 / 93

EECS 150 Homework 7 Solutions Fall (a) 4.3 The functions for the 7 segment display decoder given in Section 4.3 are:

R07. Code No: V0423. II B. Tech II Semester, Supplementary Examinations, April

1. Draw general diagram of computer showing different logical components (3)

EE 459/500 HDL Based Digital Design with Programmable Logic. Lecture 6 Combinational and sequential circuits

ENGIN 241 Digital Systems with Lab

Control and Datapath 8

2. List the five interrupt pins available in INTR, TRAP, RST 7.5, RST 6.5, RST 5.5.

Systems Programming. Lecture 2 Review of Computer Architecture I


Chapter 19. Floppy Disk Controller Discussion. Floppy Disk Controller 127

CMPE 413/ CMSC 711. Project Specification: 16 bit 2 s complement Adder and 8 bit 2 s complement multiplier. GND. Input bus. Latches I[8]-I[15]

Written Re-exam with solutions for IE1204/5 Digital Design Friday 10/

The block diagram representation is given below: The output equation of a 2x1 multiplexer is given below:

Lecture 12 VHDL Synthesis

EEE 2243 Digital System Design TEST 1

ECE 545 Lecture 5. Data Flow Modeling in VHDL. George Mason University

Transcription:

CHAPTER NINE - MSI Logic Circuits 9. (a) All of the outputs are HIGH. (b) O =, O- O7 = (c) O - O6 =, O7 =. (d) Same as (a). 9.2 Inputs = 6: Outputs = 64 9.3 (a) [ O6] -> A2=, A=, A=, E3=, E2 =, E= (b) [ O3] -> A2=, A=, A=, E3=, E2 =, E= (c) [ O5] -> A2=, A=, A=, E3=, E2 =, E= (d) 9.4 [ O and O7] -> Only ONE output can be active at a time. 9.5 Each 74LS293 is connected as a MOD-8 (Q not used). The output O3 will be LOW only when A2 A A =, E3=, E2 =. This condition is present after the 28 th and 29 th NGTs of the clock. That is: 28 = 2 29 = 2 Thus, O3 will appear as shown below: 9.6 There are several possible solutions. One is given below. 63

9.7 (a) When D=, the C,B and A inputs determine which of the outputs O7 - O will be activated. With D held HIGH, all of these outputs will be inactive (HIGH) because the input code will be greater than 2 (7 ). (b) 9.8 9.9 For Relay K to be energized from t 3 to t 5, tie outputs O3 and O4 of 7445 together. For Relay K2 to be energized from t 6 to t 9 tie outputs O6, O7 and O8 of 7445 together. This can be done because the 7445 has open-collector outputs and only one of its outputs will be active (LOW) at any one time. 64

9. 9. (a) With CONTROL= (b) With CONTROL= 9.2 The 'g' segment should be active for the following decimal digits: 2,3,4,5,6,8,9. 9.3 (a) Encoder (b) Encoder (c) Decoder (d) BCD-to-7-segment decoder (e) Decoder/driver 9.4 The 7447 responds to higher-order A8. Thus, the encoder output will be the complement of the code for 8. That is. 65

9.5 9.6 One possible design is shown below: 66

9.7 If the fourth key were actuated, it would be entered into the MSD. For example, if you entered 395, the 5 would replace the 3 in the MSD so you would see 59 on the displays. The following circuit will prevent the fourth key actuation from having any effect (until CLEAR is again actuated). The PGT at Z will set W=. This will hold gate output HIGH and prevent further key actuation from clocking the ring counter. 9.8 Choice (b) is the only one, which would give the symptoms described. If Q is triggering the X,Y,Z register, a negative-going transition will occur immediately upon the actuation of a digit key. This would cause the shift register to shift and produce a positive-transition at one of the X,Y or Z outputs before the outputs of the encoder have stabilized due to switch bounce. Choice (c) could not be the cause of the symptoms described, since it would trigger the OS more than once for a given key actuation, thereby affecting more than one register. 9.9 Choice (a) could cause this symptom because the open input to the OR gate would produce a constant HIGH at its output (for TTL), thereby preventing any clocking of the ring counter. Choice (d) could also cause this symptom. The LOW at Y could pull down the HIGH at Z so that the ring counter stays at 2. 9.2 (a) Yes. An open would result in a constant HIGH at the D inputs of the FFs. Since this is the LSB, the result would always be an odd-numbered entry. (b) No. OR-gate output would be stuck HIGH, freezing all operation (c) No. Same as (b). 9.2 A2 Bus line is open between IC-Z2 and IC-Z3. 9.22 Either the output of the INVERTER or input (2) on the NAND gate of Z4 is internally, or externally shorted to Ground. 9.23 (a) Segment 'g' would be much brighter than the other six segments. (b) Segment 'g' of display and/or output transistor of 7446/7447 could burn out. 9.24 Inputs D and C to the BCD-to-7-segment decoder/driver have been wired in reversed order. 9.25 Segments 'a' and 'b' of the display are always ON. A short between the cathodes of segments 'a' and 'b' must exist. 9.26 One possibility: The unused inputs of the remaining XOR gate were left floating (to get 7 XOR gates you need 2 quad 2-input XOR ICs). Most probable cause: Connection 'f' from the BCD-to-7 segment dec./driver to the XOR gate is open. 67

9.27 9.28 9.29 S S Output I I2 I I3 The circuit of figure 9.75 functions as a 4-input Multiplexer. 68

9.3 (a) (b) _of_8 data data inst _of_2 result sel data3 data2 data data inst3 _of_4 result sel[..] data7 data6 data5 data4 data3 data2 data data result inst2 sel[2..] 9.3 (a) 69

(b) 9.32 (b) The total number of connections in the circuit using the Multiplexers is 63, not including Vcc and GND. The total number required for the circuit using separate decoder/drivers and displays for each BCD counter is 66. 9.33 Assume counter starts at 2. 9.34 When MSB of counter goes HIGH, it disables the MUX output so that Z=. 9.35 Therefore, connect I 3, I 5, I 6 and I 7 to Vcc. Connect all other MUX inputs to ground. 7

9.36 9.37 Connect inputs I, I 5, I 8, I, I 4 and I 5 to Vcc. Connect all other MUX inputs to ground. 9.38 (a) Z C B A D C B A D C B A D= D= DCBA Z DCBA Z ICBA I = I =D I 2 = I 3 = I 4 = D I 5 = I 6 = I 7 = 7

(b) D= D= DCBA Z DCBA Z ICBA I = D I = I 2 = I 3 = I 4 = I 5 = I 6 = I 7 =D 9.39 (a) Encoder, Multiplexer (b) Multiplexer, Demultiplexer (c) Multiplexer (d) Encoder (e) Decoder, Demultiplexer (f) Demultiplexer (g) Multiplexer 9.4 9.4 When A=B=C=, output Q will follow the DATA INPUT; all other outputs stay HIGH. 72

9.42 (a) All of the LEDs will be off. (b) Each LED will flash in sequence ( through 7) for.s. (c) When the MOD-8 CTR reaches the count of 2 (), the output of the MUX will be the complement of I2 (LOW). At this time the DEMUX will be active and O2 will be LOW allowing LED #2 to be lit for.s. When the counter reaches the count of 6 ( 2 ), which will be.4s later, LED #6 will lit for.s. This will continue as the counter sequences through its 8 states. 9.43 As the circuit below shows, five lines will go to the remote monitoring panel. 9.44 73

9.45 74

9.46 (a) Sensor output 3 will not be allowed to go HIGH when Actuator #3 is activated at the count of 3. This will not allow the counter to be incremented. Thus, the process sequence will be terminated at this time. (b) When Actuator #3 is activated sensor #3 and I 4 of MUX will be HIGH. Since at this time the select inputs of the MUX are at the count of 3 ( 2 ) its output will reflect the status of I 3, which is LOW. Thus, the counter won't get incremented and the process sequence will halt. 9.47 Clearly, the MSB (Za) of the 7457 MUX (tens) never goes HIGH. A possible cause could be that the connection from MUX (tens) to the BCD-to-7 segment decoder/driver is shorted to ground. 9.48 Connections Q and Q of the MOD-8 CTR are reversibly connected to the select inputs of the MUX and DEMUX. This will cause the select inputs to change in the sequence:, 2,, 3, 4, 6, 5, 7. 9.49 There is a short between inputs I 6 and I 7 of the 74HC5 MUX. 9.5 By examining the waveforms the following is observed: 9.5 I. All of the signals appear to be correct between t and t9, with the O signal containing the serial data from register A, and O containing the serial data from register B. II. The O2 and O3 outputs are never activated. III. Between t and t4, the O output, rather than O2, contains the serial data from register C. IV. Between t4 and t8, the O output, rather than O3, contains the serial data from register D. It appears that the select inputs of the receiver's DEMUX are selecting only O and O. This would happen if S were stuck in the LOW state. This stuck node could be caused by an internal short to ground at S, Q, or an external short to ground. 75

9.52 9.53 (a) * another solution would be to add a third 74HC85 to the arrangement of figure 9.37(b). 76

(b) Prob9_53b unsigned compare dataa[9..] datab[9..] aeb agb alb inst 9.54 D C B A D C B A BCD input = c S3 S2 S S Sum at the output of the first 75LS83 = S3 S2 S S Sum at the output of the second 75LS83 = b6 b5 b4 b3 b2 b b Binary output = 9.55 By looking at the results at the "Binary output" it can be concluded that a problem exists for the first two BCD conversions (52 and 95), and that the last conversion for the BCD number 27 is without fault. Further investigation can bring to conclusion that for the conversions that exhibit a fault the actual condition of b is always the opposite of what it should be with the exception of the last conversion for the BCD number 27. Now, what than is the major difference between the two first BCD numbers (52, 95) and the last one (27)? The answer is that the last BCD number (27) is the only one with A=b. Thus, the most probable cause for the fault is b being connected to B instead of A. 9.56 True: (a), (c), (e) False: (b), (d) 9.57 Register C: OEB ;IEC Registers A and B: OEB OEA ;IEB IEA The contents of register [C] will be transferred to registers [A] and [B] when a CLOCK pulse is applied. 9.58 (a) @ t [A] = ; [B] = ; [C] = { [B] [C] } @ t2 [A] = ; [B] = ; [C] = @ t3 [A] = ; [B] = ; [C] = @ t4 [A] = ; [B] = ; [C] = { [A] [B] [C] } (b) Since the registers' outputs are all in their HI-Z mode, register A would be loaded with unpredictable data (noise) that would be floating on the Bus. 77

9.59 9.6 (a) Set switches at SW3=, SW2=, SW=SW=. Make ESW= and IEA = ; all other input and output enables are kept HIGH. Apply CLOCK pulse. Set switches at. Make ESW= and IEB=. Apply CLOCK pulse. Set switches at. Make ESW= and IEB=. Apply CLOCK pulse. (b) The 74HC74 register is clocked by the same CLOCK signal as the A, B, C registers. Thus, each time data is transferred to one of these registers, the 74HC74 will latch the same data. Since the last operation transferred to register C, the 74HC74 will also hold 2. 9.6 (a) At t, ESW= and IEA = I because of the levels at OS, OS, IS and IS. This will transfer levels from the switches to register A. Thus, [A] =. The 74HC74 register will also hold 2. Other registers have 2. At t 2, OEA = and IEC=. Thus, [A] [C] so that [C]= 2, as does the 74HC74 register. At t 3, OEC = and IEB=. Thus, [C] so that [B]=. All registers are now holding 2. (b) In theory, the answer is "no" because only one decoder output can go LOW at one time, and so only one device's outputs can be enabled. However, in practice there will be a very short overlap interval where two devices' outputs are enabled as the output select code changes from one code to another. 9.62. Connect Esw from figure 9-67 to the ENABLE input of the 74HC54. 2. Connect SW-SW3 to the inputs of the first four-tristate buffers of the 74HC54 IC. Connect the other four unused inputs of the 74HC54 IC to ground. 9.63 (a) 57FA 6 To activate the memory module O2 of the 74LS38 must be LOW. Therefore, A=, A=, A2=, E3=, E2, E=. Thus, CP must go LOW at the same time the address bus has the following: A5 A4 A3 A2 A A A9 A8 A7 A6 A5 A4 A3 A2 A A x x x x x x x x x x x [B] 78

(b) (c) Hence, any address from 5 6 to 57FF 6 will be acceptable. To activate the memory module O4 of the 74LS38 must be LOW. Therefore, A=, A=, A2=, E3=, E2, E=. Thus, CP must go LOW at the same time the address bus has the following: A5 A4 A3 A2 A A A9 A8 A7 A6 A5 A4 A3 A2 A A x x x x x x x x x x x Thus, any address from 9 6 to 97FF 6 will activate the second module. (d) No. In order for the MPU to READ from or WRITE to both modules at the same time both memory-modules would have to be active at the same time. This is impossible because only one output from the decoder can be active (LOW) at any one time. Therefore, both O2 and O4 of the decoder 74LS38 cannot be LOW at the same time. 9.64 One possible design is shown below: 79

9.65 % BCD TO DECIMAL DECODER SIMILAR TO A 7442 % SUBDESIGN prob9_65 ( a[3..] :INPUT; --binary inputs ) END; O9,O8,O7,O6,O5,O4,O3,O2,O,O :OUTPUT; --decoded outputs DEFAULTS O8=VCC;O9=VCC; O7=VCC;O6=VCC;O5=VCC;O4=VCC; O3=VCC;O2=VCC;O=VCC;O=VCC; END DEFAULTS; CASE a[] IS WHEN => O = GND; WHEN => O = GND; WHEN 2 => O2 = GND; WHEN 3 => O3 = GND; WHEN 4 => O4 = GND; WHEN 5 => O5 = GND; WHEN 6 => O6 = GND; WHEN 7 => O7 = GND; WHEN 8 => O8 = GND; WHEN 9 => O9 = GND; END CASE; --defaults all HIGH out -- BCD to decimal decoder similar to a 7447 ENTITY prob9_65 IS PORT ( a :IN BIT_VECTOR (3 DOWNTO ); O :OUT BIT_VECTOR (9 DOWNTO ) ); END prob9_65 ; ARCHITECTURE truth OF prob9_65 IS WITH a SELECT O <= "" WHEN "", --O active "" WHEN "", --O active "" WHEN "", --O2 active "" WHEN "", --O3 active "" WHEN "", --O4 active "" WHEN "", --O5 active "" WHEN "", --O6 active "" WHEN "", --O7 active "" WHEN "", --O8 active "" WHEN "", --O9 active "" WHEN OTHERS; --disabled END truth; 8

9.66 -- HEX decoder driver for a 7-seg display SUBDESIGN prob9_66 ( hex[3..] :INPUT; --4-bit number lt, bi, rbi :INPUT; --3 independent controls a,b,c,d,e,f,g,rbo :OUTPUT; --individual outputs ) IF!bi THEN (a,b,c,d,e,f,g,rbo) = (,,,,,,,); % blank all % ELSIF!lt THEN (a,b,c,d,e,f,g,rbo) = (,,,,,,,); % test segments % ELSIF!rbi & hex[] == THEN (a,b,c,d,e,f,g,rbo) = (,,,,,,,); % blank leading 's % ELSE TABLE % display 7 segment Common Anode pattern % hex[] => a,b,c,d,e,f,g,rbo; =>,,,,,,,; =>,,,,,,,; 2 =>,,,,,,,; 3 =>,,,,,,,; 4 =>,,,,,,,; 5 =>,,,,,,,; 6 =>,,,,,,,; 7 =>,,,,,,,; 8 =>,,,,,,,; 9 =>,,,,,,,; =>,,,,,,,; =>,,,,,,,; 2 =>,,,,,,,; 3 =>,,,,,,,; 4 =>,,,,,,,; 5 =>,,,,,,,; END TABLE; END IF; END; -- HEX to 7-segment decoder ENTITY prob9_66 IS PORT ( hex :IN INTEGER RANGE TO 5; lt, bi, rbi :IN BIT; a,b,c,d,e,f,g,rbo ); END prob9_66 ; :OUT BIT; ARCHITECTURE vhdl OF prob9_66 IS PROCESS (hex, lt, bi, rbi) VARIABLE segments :BIT_VECTOR ( TO 6); IF bi = '' THEN 8

segments := ""; rbo <= ''; -- blank all ELSIF lt = '' THEN segments := ""; rbo <= ''; -- test segments ELSIF (rbi = '' AND hex = ) THEN segments := ""; rbo <= ''; -- blank leading 's ELSE rbo <= ''; CASE hex IS -- display 7 segment Common Anode pattern WHEN => segments := ""; WHEN => segments := ""; WHEN 2 => segments := ""; WHEN 3 => segments := ""; WHEN 4 => segments := ""; WHEN 5 => segments := ""; WHEN 6 => segments := ""; WHEN 7 => segments := ""; WHEN 8 => segments := ""; WHEN 9 => segments := ""; WHEN => segments := ""; WHEN => segments := ""; WHEN 2 => segments := ""; WHEN 3 => segments := ""; WHEN 4 => segments := ""; WHEN 5 => segments := ""; END CASE; END IF; a <= segments(); --assign bits of array to output pins b <= segments(); c <= segments(2); d <= segments(3); e <= segments(4); f <= segments(5); g <= segments(6); END PROCESS; END vhdl; 9.67 % LOW priority encoder. Encodes lowest order input that is activated. % SUBDESIGN prob9_67 ( sw[9..], oe d[3..] ) VARIABLE buffers[3..] :INPUT; :OUTPUT; :TRI; IF!sw[] THEN buffers[].in = ; ELSIF!sw[] THEN buffers[].in = ; ELSIF!sw[2] THEN buffers[].in = 2; ELSIF!sw[3] THEN buffers[].in = 3; ELSIF!sw[4] THEN buffers[].in = 4; ELSIF!sw[5] THEN buffers[].in = 5; ELSIF!sw[6] THEN buffers[].in = 6; ELSIF!sw[7] THEN buffers[].in = 7; ELSIF!sw[8] THEN buffers[].in = 8; 82

ELSIF!sw[9] THEN buffers[].in = 9; ELSE buffers[].in = ; END; END IF; buffers[].oe = oe & sw[]!=b""; d[] = buffers[].out; -- enable when OE AND key pressed -- connect to outputs -- LOW Priority encoder LIBRARY ieee; USE ieee.std_logic_64.all; ENTITY prob9_67 IS PORT( sw :IN BIT_VECTOR (9 DOWNTO ); --standard logic not needed oe :IN BIT; --standard logic not needed d :OUT STD_LOGIC_VECTOR (3 DOWNTO ) --must use std logic for hi-z ); END prob9_67; ARCHITECTURE a OF prob9_67 IS d <= "ZZZZ" WHEN ((oe = '') OR (sw = "")) ELSE "" WHEN sw() = '' ELSE "" WHEN sw() = '' ELSE "" WHEN sw(2) = '' ELSE "" WHEN sw(3) = '' ELSE "" WHEN sw(4) = '' ELSE "" WHEN sw(5) = '' ELSE "" WHEN sw(6) = '' ELSE "" WHEN sw(7) = '' ELSE "" WHEN sw(8) = '' ELSE "" WHEN sw(9) = ''; END a; 9.68 -- modified Fig9-66 to make an 8-bit comparator SUBDESIGN prob9_68 ( a[7..], b[7..] :INPUT; gtin, ltin, eqin :INPUT; % cascade inputs % agtb, altb, aeqb :OUTPUT; ) % standard cascade inputs: gtin = ltin = GND eqin = VCC % END; IF a[] > b[] THEN agtb = VCC; altb = GND; aeqb = GND; ELSIF a[] < b[] THEN agtb = GND; altb = VCC; aeqb = GND; ELSE agtb = gtin; altb = ltin; aeqb = eqin; END IF; 83

-- modified Fig9-66 to make an 8-bit comparator ENTITY prob9_68 IS PORT ( a, b : IN INTEGER RANGE TO 255; gtin, ltin, eqin : IN BIT; -- cascade inputs agtb, altb, aeqb : OUT BIT); END prob9_68; -- standard cascade inputs: gtin = ltin = '' eqin = '' ARCHITECTURE vhdl OF prob9_68 IS PROCESS (a, b, gtin, ltin, eqin) IF a < b THEN altb <= ''; agtb <= ''; aeqb <= ''; ELSIF a > b THEN altb <= ''; agtb <= ''; aeqb <= ''; ELSE altb <= ltin; agtb <= gtin; aeqb <= eqin; END IF; END PROCESS; END vhdl; 9.69 -- A 4-bit binary to 2-digit BCD converter SUBDESIGN prob9_69 ( binary[3..] :INPUT; ones[3..], tens[3..] :OUTPUT; ) END; IF binary > 9 THEN tens[] = B"" ; ones[] = binary[] - ; ELSE tens[] = B""; ones = binary[]; --A 4-bit binary to 2-digit BCD converter ENTITY prob9_69 IS PORT ( binary :IN INTEGER RANGE TO 5; ones, tens :buffer INTEGER RANGE TO 9); END prob9_69; ARCHITECTURE vhdl OF prob9_69 IS PROCESS (binary) IF binary > 9 THEN tens <= ; ones <= binary - ; ELSE tens <= ; ones <= binary ; 84

END IF; END PROCESS; END vhdl; 9.7 -- 3-digit BCD to 8-bit binary code converter handles input values - 255 SUBDESIGN prob9_7 ( hundreds[..], tens[3..], ones[3..] :INPUT; binary[7..] :OUTPUT; ) VARIABLE timesten[7..] :NODE; % variable for tens digit times % timeshund[7..] :NODE; % variable for hundreds digit times % timeshund[] = (hundreds[],b"") + (B"",hundreds[],B"") + (B"",hundreds[],B""); % shift left 6X (times 64) + shift left 5 X (time 32) + shift left 2X (times4) % timesten[] = (B"",tens[],B"") + (B"",tens[],B""); % shift left 3X (times 8) + shift left X (times 2) % binary[] = timeshund[] + timesten[] + (B"",ones[]); % tens digit times + ones digit % END; -- 3-digit BCD to 8-bit binary code converter handles input values - 255 ENTITY prob9_7 IS PORT ( ones, tens :IN INTEGER RANGE TO 9; hundreds :IN INTEGER RANGE TO 2; binary :OUT INTEGER RANGE TO 255); END prob9_7 ; ARCHITECTURE vhdl OF prob9_7 IS SIGNAL timesten :INTEGER RANGE TO 9; SIGNAL timeshund :INTEGER RANGE TO 2; timeshund <= hundreds * ; timesten <= tens * ; binary <= timeshund + timesten + ones; END vhdl; 85