Incrementer Troubles

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

Incrementer Troubles

jaromdl
Here's what I've done for the incrementer:

   Add16(a[0]=in[0], b[0]=true, out[0]=out[0]);
   Add16(a[1..15]=in[1..15], b[1..15]=false, out[1..15]=out[1..15]);

This seems pretty straight-forward to me, yet it still doesn't work.  I figured it might have to do with a bug in the Add16 chip, but I've tested it multiple times, manually and with the supplied test file without failure; works great.

Here are the test results from manually playing around with the Inc16 in the HardwareSimulator:

Input/Output Pins
    input: 00000000 -> output: 00000001
    input: 00000001 -> output: 00000000
    input: 00000010 -> output: 00000011
    input: 00000011 -> output: 00000010

Part Pins:
    a[0] in[0] 0000000000000001
    b[0] true 1111111111111111
    out[0] out[0] 0000000000000000

    a[1..15] in[1..15] 0000000000000001
    b[1..15] false 0000000000000000
    out[1..15] out[1..15] 0000000000000001

Any help or advice would be appreciated.  Thanks!
Reply | Threaded
Open this post in threaded view
|

Re: Incrementer Troubles

cadet1620
Administrator
You have two separate Add16 chips in your incrementer.

The first Add16 adds 1 to input bit 0 to produce output bit 0. (This is effectively a Not.)
The second Add16 adds 0 to the remaining bits. There is no carry from the bit 0 addition into this addition, so nothing changes.

You need to do this with a single Add16. Look at the example in Appendix A.5.3.

--Mark
Reply | Threaded
Open this post in threaded view
|

Re: Incrementer Troubles

jaromdl
Bingo!  Thanks, Mark!