CS 2420 LAB 2 24TH March 2023 1. Design a circuit that takes as input a 4-bit sign magnitude number then generates its 2’s compliment. Minimize the circuit and implement using logic gates. Your circuit should have the least gate input cost. 2. Design a BCD to decimal decoder. Minimize and implement the circuit using basic gates. Use a seven-segment display to connect and show the output of your circuit. 3. From the parts centre in Digital Works, use the 74HC139 dual 2-to-4 line decoder to generate a truth table for a 3-to-8 line decoder. Use external gates in connection with the dual decoder to build the 3-to-8 line decoder. 4. A large building has a hallway with two doors at opposite ends. There is a light bulb in the hallway that is controlled by three switches: the first switch (S1) is attached to the first door, the second switch (S2) is attached to the second door and the last switch (S 3) is in the hallway. The two switches (S1 and S2) are closed when their respective doors open and opened when their respective doors close. The third switch (S3) is closed when there is movement in the hallway. Otherwise, it remains open. The light bulb in the hallway is switched on when either S1 or S2 is closed, or if there is movement in the hallway. If both doors are open at the same time, the light bulb is switched off. a. Model the circuit and draw a truth table to show its behaviour. b. Minimize the function for the circuit and implement using only NOR gates. c. Implement the circuit using a dual 2-to-4 line decoder. 5. A traffic metering system for controlling the release of traffic from an entrance ramp onto a superhighway has the following specifications for a part of its controller: There are three parallel metering lanes, each with its own stop (red)–go (green) light. One of these lanes, the car pool lane, is given priority for a green light over the other two lanes. Otherwise, a “round robin” scheme in which the green lights alternate is used for the other two (left and right) lanes. The part of the controller that determines which light is to be green (rather than red) is to be designed. The specifications for the controller follow: Inputs PS Car pool lane sensor (car present—1; car absent—0) LS Left lane sensor (car present—1; car absent—0) RS Right lane sensor (car present—1; car absent—0) RR Round robin signal (select left—1; select right—0) pg. 1 Outputs PL Car pool lane light (green—1; red—0) LL Left lane light (green—1; red—0) RL Right lane light (green—1; red—0) If there is a car in the car pool lane, PL is 1. If there are no cars in the car pool lane and the right lane, and there is a car in the Operation left lane, LL is 1. If there are no cars in the car pool lane and in the left lane, and there is a car in the right lane, RL is 1. If there is no car in the car pool lane, there are cars in both the left and right lanes, and RR is 1, then LL = 1. If there is no car in the car pool lane, there are cars in both the left and right lanes, and RR is 0, then RL = 1. If any PL, LL, or RL is not specified to be 1 above, then it has value 0. a. Find the truth table for the controller part. b. Find a minimum multiple-level gate implementation with minimum gate-input cost using AND gates, OR gates, and inverters. 6. Design a 2-bit magnitude comparator to compare the magnitude of two input signals A and B. The circuit has three outputs P, Q & R, such that if A<B (P=1); if A=B(Q=1) and if A>B (R=1). Implement this circuit using: a. XNOR, AND, OR and NOT gates. b. 4-to-16 line decoder. 7. Study the circuit below and show its behaviour in a truth table. Implement the same circuit using a decoder and external circuits if necessary. Clearly label your Circuit diagram. pg. 2 pg. 3