diffract| wrote
ok, so i did it but i really hate how messy this looks.
...
first off, i don't understand why i can use multi-bit internal signals as long as i don't subscript them explicitly; i hope this is a limitation that is planned to get fixed. i can use subscripts with internal bits in normal VHDL but not here.
and second, it seems i cannot connect a pin to high or low easily. By easily i mean using a statement like "binaryOne = false", or "set binaryOne false", i had to write a chip called setTo1 and use Not gates just so i can assign the binary values i wanted to the 16-bit input. this is very inefficient as i'm using a set of 16 Not gates unnecessarily just to assign a value.
The trick with internal buses is to create them the width that you need at the source. You can connect more than one wire to an output. For example, "Not16(..., out=out, out[0:7]=lowByteOut)" if you need both full width and half width outputs.
For constant inputs, true and false expand automatically to match the width of the input they are connected to. You can say, for instance, "in[0]=true, in[1..15]=false".
Using this technique you can write your Negate16 using just a Not16 and an Add16.
--Mark