sos help me

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

sos help me

cnboy
   in project/02  
   Add16(a= ,b= ,out= ); Add16 is this format,but the next fromat is right?
   Add16(a=in,b[0]=true,b[1..15]=false,out=out);
Reply | Threaded
Open this post in threaded view
|

Re: sos help me

WBahn
Administrator
What happens when you try it?
Reply | Threaded
Open this post in threaded view
|

Re: sos help me

cnboy
np problem,but this function assigns values to groups of parameters in batches. Isn't this a violation of syntax
Reply | Threaded
Open this post in threaded view
|

Re: sos help me

WBahn
Administrator
What are you seeing that would (or you think would) indicate that this would be a syntax error?

Reply | Threaded
Open this post in threaded view
|

Re: sos help me

cnboy
What are you seeing that would (or you think would) indicate that this would be a syntax error?

because Adder16(a=,b=,out=);  this function must have three parameter(more than one or one less would be a fault)。 Maybe it's because I don't know HDL syntax

thank you。I remember this, and I continue to learn that.  thank you ,thank you,thank you
Reply | Threaded
Open this post in threaded view
|

Re: sos help me

WBahn
Administrator
Okay, that gives me some context to make a (hopefully) more meaningful explanation.

Connections in this (and many) HDLs are made not by position, but by name. So, for instance, you can take the Nand gate and write it as

Nand(a=tom, b = sue, out=fred);

and this is completely identical to

Nand(b = sue, out = fred, a=tom);

For parts with a bus connection, think of the bus pins as collections of multiple separate pins (which is exactly what they are).

So, for instance, the Or8Way(in[8], out) doesn't have two parameters, it has nine separate, distinct connections. For our convenience (and sanity), they allow us to connect multiple pins at a time, provided they are adjacent in the bus. So we can have something like:

Or8Way(in[3] = sue, out = fred, in[0..2] = tom, out = karen, in[4..7] = bob);

provided sue is a single bit signal, tom is a 3-bit signal, and  bob is a 4-bit signal).

Notice that out is used twice. This is fine. In fact, this is the only way to connect the output of a gate to other gates as well as an output of the overall chip. Think of the signals as physical wires and all we are doing is connecting the wire named 'fred' to the output of the Or8Way chip as well as connecting the signal named 'karen' to it.

What is important (and not always enforced by the tools, which leads to very hard to diagnose runtime problems) is that every input signal must be connected to exactly one driving signal -- either an input of the overall chip or an output of some other part within the design.

Outputs do not have to be connected to anything. Of course, if the part only has a single output, then there's no value in using the part if the output isn't connected. But some parts have multiple outputs and if we don't need to use them all, then we can ignore the ones we don't need and just use the ones we do.