Inc16 Help

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

Inc16 Help

nathan613
I tried doing it all in one line, since Add16 should take care of the 16 bits.
My code:
Add16(a=in, b[0]=true, b[1..15]=false, out=out);

I got "comparison error".  I tried variations on this, but no help.
Please enlighten me!
Reply | Threaded
Open this post in threaded view
|

Re: Inc16 Help

cadet1620
Administrator
Your implementation of Inc16 is correct.

The problem must be with your Add16.
You can confirm this by renaming your Add16.hdl to something like Add16.hdl.x to force the simulator to use its built-in Add16.

One other thing to check, since you didn't indicate what line is failing to compare. Double check that you are loading the Inc16.tst file form the same directory where your Inc16.hdl is. I've made that mistake way too many times of the years :-(

--Mark


Reply | Threaded
Open this post in threaded view
|

Re: Inc16 Help

nathan613
Thanks - it was indeed the Add16. I was doing, for ex.,  sum=sum[4] when I now realize it should have been sum= out[4]. I changed it, and Inc16 works fine.
Reply | Threaded
Open this post in threaded view
|

Re: Inc16 Help

cadet1620
Administrator
If your bad Add16 was passing the Add16.tst, I'd be curious to see it.  I might be able to to fix the test to catch that class of problems.

--Mark