0

If sel = false, then out should contain the lower 4-bits of in (i.e. in[0], in[1], in[2], in[3])
If sel = true, then out should contain the upper 4-bits of in (i.e. in[4], in[5], in[6], in[7])

Here is my code and how to modify it....?

CHIP NewMux
{
   IN in[8], sel;
   OUT out[4];
PARTS:
   Mux4(sel=sel, a=in[0], b=false, out=out[0]);
   Mux4(sel=sel, a=in[1], b=false, out=out[1]);
   Mux4(sel=sel, a=in[2], b=false, out=out[2]);
   Mux4(sel=sel, a=in[3], b=false, out=out[3]);
   Mux4(sel=sel, a=in[4], b=true, out=out[0]);
   Mux4(sel=sel, a=in[5], b=true, out=out[1]);
   Mux4(sel=sel, a=in[6], b=true, out=out[2]);
   Mux4(sel=sel, a=in[7], b=true, out=out[3]);
}
zubergu
  • 3,646
  • 3
  • 25
  • 38
ezyzw1
  • 1

1 Answers1

1

You cannot have multiple components generating the same outputs. You have 4 output lines, so you need to use 4 simple 1 bit muxes. Each will take as inputs the sel value and two of your in lines and generate a single out line.

MadOverlord
  • 1,034
  • 6
  • 11