One step to go in ALU

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

One step to go in ALU

nathan613
I got past the intermediate test script and now I'm trying to find a way to output ng and zr. My issue here is that everything is in 16-bit format. I'm not succeeding in finding a way to reduce to one-bit format.
ex, My very last Mux16 solved the last "no" test, and my out is in 16 bits. Let's call it outcmp. How do a get something like outcmp[0] to test with simple gates to determine zr then ng?
Reply | Threaded
Open this post in threaded view
|

Re: One step to go in ALU

ybakos
First, the concepts. Is the following four-bit number positive or negative:

1111

How do you know?

Now, given a four bit number, if bit 0 or bit 1 or bit 2 or bit 3 are a 1, is the four-bit number 0?

As for the HDL, you can isolate one or more bits of a 16-bit bus during output, eg:

ChocolateChip16(in=chocolate, out[0]=LSB, out[1..15]=otherBits, out[5..12]=middleBits);

Reply | Threaded
Open this post in threaded view
|

Re: One step to go in ALU

cadet1620
Administrator
In reply to this post by nathan613
nathan613 wrote
 My issue here is that everything is in 16-bit format. I'm not succeeding in finding a way to reduce to one-bit format.
First thing is to check out Appendix A section 5.3. Look at the example and note how you can have more than one "out=" connection on a part. (It's like soldering more than one wire to a physical output pin.)

Armed with that info you'll be adding more "out="s to to your 'no' handling Mux16.

What bit of 'out' indicates that a number is negative? 'ng' is just an out= connection.

For 'zr' think about what makes a binary number non-zero. What part that you made in project 1 that you haven't used yet might be useful to determine if half a 16-bit number is non-zero?

--Mark