Nand2Tetris Questions and Answers Forum
›
Hardware
›
Chapter 2
Search
everywhere
only in this topic
Advanced Search
Using MUX16 inside ALU to implement zx
Classic
List
Threaded
♦
♦
Locked
3 messages
Jorge Bendahan
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Using MUX16 inside ALU to implement zx
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??
cadet1620
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Using MUX16 inside ALU to implement zx
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
Jorge Bendahan
Reply
|
Threaded
Open this post in threaded view
♦
♦
|
Re: Using MUX16 inside ALU to implement zx
Solved Thanks!
Free forum by Nabble
Edit this page