Using MUX16 inside ALU to implement zx

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

Using MUX16 inside ALU to implement zx

Jorge Bendahan
Hi i'm trying to implement the first two functions of the ALU, the zx and nx (Actually i'm stuck on zx :( ).
So far i have the following code:

CHIP ALU
{
IN:
x[16];
y[16];
zx;
nx;
...

OUT:
...

PARTS:

  Mux16(a[0..15]=x[0..15],b[0..15]=false,sel=zx,out[0..15]=arr0[0..15]);
// If zx = 0 then arr0[16] = a[16] else arr0 will be zeroed
}

The Hardware Emulator is giving me the following error: sub bus of and internal node may not be used

Why can't I wire out to arr0??
Reply | Threaded
Open this post in threaded view
|

Re: Using MUX16 inside ALU to implement zx

cadet1620
Administrator
You don't need to use the [] syntax unless you need less than the full width of the bus.  Instead of
    Mux16(a[0..15]=x[0..15],b[0..15]=false,sel=zx,out[0..15]=arr0[0..15]);
try
    Mux16(a=x,b=false,sel=zx,out=arr0);

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

Re: Using MUX16 inside ALU to implement zx

Jorge Bendahan
Solved Thanks!