using internal node as a select line

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

using internal node as a select line

nasserAlhouti
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.
Reply | Threaded
Open this post in threaded view
|

Re: using internal node as a select line

WBahn
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.
Reply | Threaded
Open this post in threaded view
|

Re: using internal node as a select line

nasserAlhouti
// 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 ??
Reply | Threaded
Open this post in threaded view
|

Re: using internal node as a select line

nasserAlhouti
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  
Reply | Threaded
Open this post in threaded view
|

Re: using internal node as a select line

WBahn
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.
Reply | Threaded
Open this post in threaded view
|

Re: using internal node as a select line

WBahn
Administrator
In reply to this post by nasserAlhouti
You are trying to use a one-bit sub bus of an internal signal.

Say I have a chip named Fred that has an 8-bit output named out. I need to connect the full 8-bits to one part and just the next to least significant bit to another part.

Fred(out = fullwidthbus, out[1] = justonebit);
Reply | Threaded
Open this post in threaded view
|

Re: using internal node as a select line

nasserAlhouti
OOOOOOOh okay that makes much more sense thank you sooooo much for clarifying it. I would have spent all night trying to figure it out if you hadn't replied so again I really appreciate it.