Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a circuit that can add and subtract two 2-bit two\'s complement binary nu

ID: 3604105 • Letter: D

Question

Design a circuit that can add and subtract two 2-bit two's complement binary numbers and check for overflow. Your circuit should have a 2-bit input A = a2a1, a 2-bit input B = b2b1, a 1-bit input M, a 2-bit output S = s2s1, and a 1-bit output OF. When M = 0, the output S should be the sum of A and B (i.e. S = A + B), and when M = 1 the output should be S = A - B. The output OF should be 1 if overflow occurs.  

a. Create a truth table for the circuit described above. The truth table has been created below with a few filled out as examples, fill out the rest of the table.

b. Draw the resulting circuit diagram.

A1 AO B1 BO B1' BO Cout 1 Cout O s1 So OF English Description of Row MODE PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) PLUS (0) MINUS (1) 0 0000 0 MINUS (1) 0 MINUS (1) | 0 1 MINUS (1) 0 01 MINUS (1) 0 1 0 MINUS (1) 0 10 1 1 0 0 0 0x X o 00 1x X 0 0 1 1x x 0 1 0 0x x 0 1 0 1x X 0 1 1 0x X 0 1 1 1x X 1 0 0 0xX 1 0 0 1 x x 1 0 1 0x X 1 01 1x X 1 1 0 0x X 1 1 0 1x X 11| 1 x x 1 1 1 1x X 0 0 0 1 1 0 11 "1+1=2 OVERFLOW!" 0 "-2 + 0 =-2" 0 1 1"-1+ -2-3 OVERFLOW!" 0 01 1 1 Cannot represent +2 in two bits 0 1"O+2 2 OVERFLOW Special Case 1 0 1 0 0 0 Cannot represent +2 in two bit MINUS (1) 01 o MINUS (1) 0 11 MINUS (1) 1 00 00 0 MINUS (1) 1 0011 1 MINUS (1) 1 0101 0 MINUS (1) 1 01 1 MINUS (1) 1 10 MINUS (1) 1 10 MINUS (1) 1 11 MINUS (1) 1 11 10 1 1 0 1 Cannot represent +2 in two bits. 1 1 1 0 1 0 Cannot represent +2 in two bits.

Explanation / Answer

rabbit0 = 100; fox0 = 10; Y0 = [rabbit0; fox0]; % pack the i.c. into a column vector % testing -- uncomment for simple call to make a plot % ode45(@lotka, [0 365], Y0) % % return % set the time interval for solving Tstart=0; Tend = 365*2; % 2 years % solve the ODE [T, X] = ode45(@lotka, [Tstart, Tend], Y0); % unpack the results. % In the output array X, variables are in each column, with time running down the rows rabbits = X(:,1); % all rows, first column foxes = X(:,2); $ all rows, second column % make some nice plots figure % time series subplot(2,1,1) plot (T,rabbits, T,foxes) xlabel('Day') ylabel('Population') legend('Rabbits', 'Foxes') % rabbits vs foxes subplot(2,1,2) plot (rabbits,foxes) xlabel('Rabbits') ylabel('Foxes') end function rate = lotka(t, V) % Poulation growth of Rabbits and Foxes % Note that rabbits is first column, foxes second % unpack the dependent varables rabbits = V(1); foxes = V(2); % set some parameters a= 0.1; b= 0.01; c= 0.1; e= 0.2; % a= 0.1*(1 + .5*sin(2*pi*t/365)); % allow annual cycle in rabbit growth % compute rates for each dependent variable dr = a*rabbits - b*rabbits*foxes; df = e*b*rabbits*foxes - c*foxes; % pack rates into a column vector as the output variable rate = [dr; df]; end Starting from this program, create a new program to solve the Lorenz system: dx/dt=-sigma*x+sigma*y dy/dt=beta*x-y-x*z dz/dt=-rho*z+xy sigma=10, beta=8/3, rho=28

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote