Mux4Way16

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

Mux4Way16

Jack ZRP
This post was updated on .
CHIP Mux4Way16 {

    IN a[16], b[16], c[16], d[16], sel[2];

    OUT out[16];



    PARTS:

    // Put your code here:

   

}

i check my code many times...
i don't know what cause the  error
Comparison failure at line 6
(the Mux16 can run suessed)
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16

Jack ZRP
This post was updated on .
CHIP Mux4Way16 {

    IN a[16], b[16], c[16], d[16], sel[2];

    OUT out[16];



    PARTS:

    // Put your code here:

   

}
it cause the same error
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16

ivant
The second implementation works fine. Try restarting the hardware simulator and load the test script directly. The simulators and emulators sometimes are left in a bad state and won't run correctly if you rerun the scripts.
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16

cadet1620
Administrator
In reply to this post by Jack ZRP
To understand why the second version is correct, you need to know that hardware bits are numbered from right to left. This is so that when a bus is carrying a binary number, bus[n] is the 2^n-weighted bit of the number.

[After your problem is resolved, please edit you post to remove the working code; we want students to discover their own solutions.]

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

Re: Mux4Way16

Jack ZRP
In reply to this post by ivant
Thank you very much!
i have restarted it
but it cannot work fine
it's the output
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16

ivant
Then the problem is probably in Mux16.hdl. Are you sure it's working correctly?
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16

Jack ZRP
 I find out the problem, it's in Mux.hdl
but it's so interesting that the Mux16.hdl can work correctly.
Reply | Threaded
Open this post in threaded view
|

Re: Mux4Way16

ivant
You should develop the gates in the order described in the book to avoid such issues. The tests on Mux16 aren't exhaustive by themselves. They rely on the Mux tests passing, which wasn't the case for you.