Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a working code for milestone 2 asap. Code must be in visual studio. 16-bit OR 2.2 Milestone 2: n-bits logic gates library -

image text in transcribed

image text in transcribed

image text in transcribed

Please write a working code for milestone 2 asap.

Code must be in visual studio.

16-bit OR 2.2 Milestone 2: n-bits logic gates library - DEMONSTRATION: Wednesday/Fri- day February 17 4t get 24/26 (depending on your group) The goal of this milestone is to enhance the simulator and the library that you created in the previous deliverable in order to handle input with i- bits. Specifically, consider that your simulator takes two signals A and B and each signal has a size of n bits. Consequently, the logic gates must be modified in order to address cases with more than two bits. A [0.3) A [071 8-bit AND B[4.7) B (0,7) (a) AND gate with 8 bits input (b) OR gate with 16 bits input Figure 6: AND and OR gate with more than two bits as inputs. The AND gate has 8-bit input while the OR gate has 16-bit input The first step is to enhance the files gates.c and gates.h by adding new functions AND_N and ORN which will take as an argument an array with all the bits and perform the corresponding actions (logical and, logical or). We will consider that only these two logical operations work on more than two bits. For example, Figure 6a shows the AND gate with 8 bits. Specifically, from signal A we take the first 4 bits (4(0,3]) and from the second signal we take the rest bits (B(4.7]). Similarly, Figure 6b shows the OR gate with 16 bits input. The AND N gate returns 1 if all values are 1 and the OR_N returns 1 if at least one input is 1. A [19.15) s-bar AND [0.31 A [03] AK R-hi AND 8.b OR 10:31 A 14.71 A471 x-bit OR OR BILI 14.73 (a) Circuit 1 with = 8 A[3] 8-bit AND [12.15 (b) Circuit 2 with n = 16 Figure 7: Custom circuits with n-bits input. The brackets next to A and B represent which bits of the two signals are used as input to the gates The second step of this milestone is to combine the developed logical gates in order to create more complicated circuits. Write a program in a file named logic-simulator circuit.n.c which simulates the two circuits presented in Figure 7. Initially, you should get the signals A and B. Each signal has a size ni which is the same for A and B and it is mentioned in the caption of each circuit. This parameter n should be defined in your program as a directive and stay constant for a simulation (since the value of n is different for each circuit you need to change it and recompile your program every time you want to simulate a different circuit). Based on this value, you should define corresponding arrays to handle the bits of the input. Your declaration must be generic. The program should also ask if the user wants to give the values for each bit of the signals or the program initializes everything with random values. For this reason you can use the function rand() function defined in stdlib.h. Then, utilize your functions written in gates.c to calculate the output of the circuits. You may need to declare additional variables in order to separate the bits of the signals and calculate the output

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions

Question

Write Hund's rule?

Answered: 1 week ago

Question

How many Tables Will Base HCMSs typically have? Why?

Answered: 1 week ago

Question

What is the process of normalization?

Answered: 1 week ago