mux4way16,help please!what's wrong with it?

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

mux4way16,help please!what's wrong with it?

bluce
CHIP Mux4Way16 { IN a[16], b[16], c[16], d[16], sel[2]; OUT out[16]; PARTS: // Put your code here: Mux16(a[0~15]=a[0~15],b[0~15]=c[0~15], sel = sel[0],out[0~15]=x[0~15]); Mux16(a[0~15]=b[0~15],b[0~15]=d[0~15], sel = sel[0],out[0~15]=y[0~15]); Mux16(a[0~15]=x[0~15],b[0~15]=y[0~15], sel = sel[1],out[0~15]=out[0~15]);
Reply | Threaded
Open this post in threaded view
|

Re: mux4way16,help please!what's wrong with it?

cadet1620
Administrator
You need to use ".." for sub-bus syntax, not "~".
HDL automatically connects all the wires in a bus.  Just say "a=a" rather than "a[0..15]=a[0..15]".

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

Re: mux4way16,help please!what's wrong with it?

cadet1620
Administrator
In reply to this post by bluce
One other thing that you need to watch out for when writing Mux4Way16 is which sel[n] controls the first pair of Mux16s and which sel[n] controls the output Mux16.

Note from Figure 1.10 that when "b" input is to be selected, sel[0] = 1 and sel[1] = 0.

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

Re: mux4way16,help please!what's wrong with it?

bluce
In reply to this post by cadet1620
Thank you so much!it works!