Add16.hdl Not Working?

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

Add16.hdl Not Working?

DrZoo
This post was updated on .
My add16.hdl file is not working, and I can't figure out why. Everything seems to be right to me, but it keeps saying comparison failure at line 3.

Here is my code:

Working code emitted
Here are pictures of the output and compare:





For project01 my hardware simulator was acting weird. It did this same thing for the Add.hld file, although the implementation of Add.hdl was correct. Is this the same thing happening, or am I really missing something?

If anything, could someone copy and paste my code and run it against the Add16.tst on your machine and reply with your results?
Reply | Threaded
Open this post in threaded view
|

Re: Add16.hdl Not Working?

cadet1620
Administrator
Your code is correct and passes the test on my system.
When the test is failing for you, all 'a' bits are 0 and all 'b' bits are 1.
All the internal 'carryN' bits can be seen to be 0, so all HalfAdder and FullAdder 'sum' bits should be 1.

That the 'out' value is 0 implies that the HalfAdder and FullAdder parts are not outputting the correct values.

Have you implemented and tested HalfAdder and FullAdder?

You can test your Add16 in isolation by creating an 02/test directory and copying only Add16.hdl, Add16.tst, and Add16.cmp into that directory.  That will force the HardwareSimulator to use the built-in versions of HalfAdder and FullAdder.

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

Re: Add16.hdl Not Working?

DrZoo
This post was updated on .
[Working code removed by moderator.]

EDIT: After you mentioned HalfAdder.hdl and FullAdder.hdl I began trying to test them again. I looked over them line by line a few times and eventually caught my error!

In FullAdder.hdl I at first implemented:

PARTS:
    ...
    HalfAdder(a=sumAB, b=c, sum=sum1, carry=carryABC);
    ...

Instead, I needed:

PARTS:
    ...
    HalfAdder(a=sumAB, b=c, sum=sum, carry=carryABC);
    ...

Thanks!