# using internal node as a select line

7 messages
Open this post in threaded view
|

## using internal node as a select line

 For my ALU design I wanted to determine if a number is negative or positive by looking at its' last bit       // checks if zx is 1 then turns all bits to zeros   Mux16(a=false,b=x,sel=zx,out=xzero); // negates xzero       Not16(in=xzero,out=notx); // checks if nx is 1 then negates x     Mux16(a=notx,b=xzero,sel=nx,out=xnegated); // checks if x is negative    Not16(in = xnegated , out = xnegated2);    Inc16(in = xnegated2,out=xComplement);       Mux16(a=xComplement,b=xnegated,sel=xnegated[15],out=resultedX); My issue lies in the fact that I can't access xnegated as its own bit in the bus of xnegated. As a result , I keep getting "sub bus of internal node may not be used". So is there a way around this issue?? I would like to apologies for my naming convention I couldn't think of any good names at the time.
Open this post in threaded view
|

## Re: using internal node as a select line

 Administrator I can't figure out what it is you are trying to accomplish from a logic standpoint (in terms of the ALU implementation), but the "sub bus of internal node" error is addressed toward the end of the Hardware Construction Survival Kit, which is linked at the top of the Chapter 1 forum page.
Open this post in threaded view
|

## Re: using internal node as a select line

 // if (f == 1)  set out = x + y  // integer 2's complement addition reading this I thought we would have to do all the operations i.e if (zx == 1) set x = 0 , // if (nx == 1) set x = !x then once we preform the addition operation after either setting the bits to zero or negating it or both then if the most significant bit of x is 1  x[15] = 1 that would mean it is a negative number so we would negate all the bits and increment it by one  which was why I wanted to use that bit as my select line if (x[15] == 1) then negate it and increment it by one.Otherwise, just output x and use the add16 chip to to the addition of bits, am I overthinking this ??
Open this post in threaded view
|

## Re: using internal node as a select line

 In reply to this post by WBahn Also in the survival guide they used sub buses I am just trying to use one bit for my select line so syntax wise I don't how to format it
Open this post in threaded view
|

## Re: using internal node as a select line

 Administrator This post was updated on . In reply to this post by nasserAlhouti Yes, you are WAY overthinking it. The spec for the ALU tells you to do something with the x and y inputs based on the zx/nx and zy/ny inputs. It then tells you to either add the results of the operations on those two inputs or perform a bitwise AND of them based on the f input. It then tells you to do something with the output of whichever one of those was chosen based on the no input.