# ZR and NG using 16wayOR gate?

11 messages
Open this post in threaded view
|

## ZR and NG using 16wayOR gate?

 I am a bit lost on the ZR and NG part of the ALU Why can I use 16wayOR gate to compute the ZR function? why do I need 8wayOR function? I read the sub-bus section and it says:  you must create the narrower bus as an output from a chip-part. Why do I need to create a narrower bus? we can have out=out, out=zr, out=ng and work on them using single 16 way OR gate Thanks for your help
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Administrator guynextdoor wrote I am a bit lost on the ZR and NG part of the ALU Why can I use 16wayOR gate to compute the ZR function? why do I need 8wayOR function? I read the sub-bus section and it says:  you must create the narrower bus as an output from a chip-part. Why do I need to create a narrower bus? we can have out=out, out=zr, out=ng and work on them using single 16 way OR gate Thanks for your help Who says that you HAVE to use the Or8Way gate? You CAN use an Or16Way if you want to -- but since it isn't one of the parts constructed in Chapter 1, it is up to you to construct it and test it adequately. But there is absolutely nothing stopping you from doing so. Most people use only the parts that are constructed in the course of working through the projects, so they will need to use a narrower bus to be compatible with the parts they have available.
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Thank you and one last question, why do we need NOT gate to get ZR value? I understand the OR gate function, but why add NOT gate? As I understand, any combination of 8 bits 1 or 0 can be fed to or8way and it outputs 1, if any of the bits are 1, the final output of the Or8way is either 0 or 1 depending on the 8 bit input. So the way I understand is, if ALL bits have condition to 0. the OR8way gives a single bit output anyway. Even if the NOT gate takes this input, how does it imply if NOT gate takes in 0 or 1, and flips the value, it implies all inputs to the OR8way are 0?? Totally confused here, thank you for your explanation,
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 What value should ZR have when all of the bits of the output are zeros?
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Administrator In reply to this post by guynextdoor Let's consider a toy example in which I have four bits, {A,B,C,D} and I want a logic block that outputs a 1 if and only if all four of those bits are 0. Now let's say that I've got an Or4Way gate and I apply my four inputs to that gate. Does the output do what I need? If not, what can I do to the output to make it do what I want? If you don't see it, make a truth table of all possible input combinations and then a column for what you want the output to be. Then make a column for the output of the Or4Way gate. What logical relationship is there between those last two columns?
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Hi, so as I understand the ORwaygate gives a single bit output from 8 bit selection. Yes I understand that all bits have to be 0 for the output to be 0, and the NOT gate flips it out. However if the ORway gate gives a 0 as single bit output. We are getting the 0 output as a single bit anyway. or as I understand the ZR output as to be 16 bit bus output? sorry for the silly question
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Administrator guynextdoor wrote We are getting the 0 output as a single bit anyway. or as I understand the ZR output as to be 16 bit bus output? What is leading you to that understanding? Look at the spec for the ALU (Figure 2.5). The ALU has three outputs: out[16], zr, and ng. The 'out' signal is a 16-bit signal. But the 'zr' and 'ng' outputs are single-bit outputs. The 'zr' output is a 1 (i.e., true) if the value of the 'out' signal is exactly 0, otherwise it is a 0 (i.e., false).
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Hi, the confusion is the following: I understand the output is 16 bit ZR, and ZR has to be equal to 1.  However when we add OR8way gate, it selects 1 input from the 8 bit input and outputs a 0, this is then converted by NOT gate to 1 for ZR.  Am I understanding this correctly?
Open this post in threaded view
|

## Re: ZR and NG using 16wayOR gate?

 Administrator guynextdoor wrote Hi, the confusion is the following: I understand the output is 16 bit ZR, and ZR has to be equal to 1.   I don't know what you mean by this, particularly the statement that "ZR has to be equal to 1". One of the output signals from the ALU is called "out" and that signal is a 16-bit output. The "zr" and "ng" signals are 1-bit signals. They are either a 0 or a 1 -- only two possible values and so only a single bit is needed. The "zr" output is a 1 if the 16-bit "out" signal is exactly "0000000000000000" and a 0 if the 16-bit "out" signal is anything else. However when we add OR8way gate, it selects 1 input from the 8 bit input and outputs a 0, this is then converted by NOT gate to 1 for ZR.   Again, your description makes little sense. You are stating that it does something and then "outputs a 0". Well, if it always outputs a 0, then there is not point having any inputs at all. An Or8Way gate does not select 1 input from among the 8 bits, it takes eight individual inputs and does a logical OR of all eight of them, meaning that it will output a 1 if ANY of the eight inputs is a 1 and will output a 0 only if ALL eight inputs are 0.