MUX16

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

MUX16

SpartanHalo
Hi guys,

this is my code:
CHIP Mux16 {
    IN a[16], b[16], sel;
    OUT out[16];

    PARTS:
        Mux(a=a[0], b=b[0], sel=sel, out=out[0]);
    Mux(a=a[1], b=b[1], sel=sel, out=out[1]);
    Mux(a=a[2], b=b[2], sel=sel, out=out[2]);
    Mux(a=a[3], b=b[3], sel=sel, out=out[3]);
    Mux(a=a[4], b=b[4], sel=sel, out=out[4]);
    Mux(a=a[5], b=b[5], sel=sel, out=out[5]);
    Mux(a=a[6], b=b[6], sel=sel, out=out[6]);
    Mux(a=a[7], b=b[7], sel=sel, out=out[7]);
    Mux(a=a[8], b=b[8], sel=sel, out=out[8]);
    Mux(a=a[9], b=b[9], sel=sel, out=out[9]);
    Mux(a=a[10], b=b[10], sel=sel, out=out[10]);
    Mux(a=a[11], b=b[11], sel=sel, out=out[11]);
    Mux(a=a[12], b=b[12], sel=sel, out=out[12]);
    Mux(a=a[13], b=b[13], sel=sel, out=out[13]);
    Mux(a=a[14], b=b[14], sel=sel, out=out[14]);
    Mux(a=a[15], b=b[15], sel=sel, out=out[15]);
}


Hardware simulator says "Comparison failure at line 4".

I don't understand because....
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

WBahn
Administrator
because... why?

I'm not a mind reader -- I can't divine what or why you don't understand something.

What does the comparison file say for Line 4?

What does your output file say for Line 4?

Which one (if either) do you agree is correct?
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

WBahn
Administrator
Also, which tool are you using? The online web-based tools or the offline tool suite?

Another post indicated that the web tools seem to be sensitive to indentation (which would be a bug). I notice that your first part is indented differently than the others. You might try cleaning that up, just in case.
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

pm100
In reply to this post by SpartanHalo
'conoarison failure's means that the result of running the simulation is wrong. The tool shows you the output of your circuit and the expected output. Line 4 is the line in the comparison file, not the line in your source code
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

SpartanHalo
In reply to this post by WBahn
Right! Excuse me but yesterday I was so tired and I posted without some important details.


a a[4] 0
b b[4] 1
sel sel 0
out out[4] 1


This is the output
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

SpartanHalo
In reply to this post by WBahn
No web based but desktop software
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

SpartanHalo
In reply to this post by pm100
This is the output

a a[4] 0
b b[4] 1
sel sel 0
out out[4] 1


Out should be 0
Reply | Threaded
Open this post in threaded view
|

Re: MUX16

SpartanHalo
In reply to this post by SpartanHalo
Guys,

it was a problem in original MUX.hdl, now it's correct!

I'd fixed the code of MUX.hdl


Thank you so much for the support!