A pin name is expected

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

A pin name is expected

CStudent
Hi!
Could you please help me? Why I cannot use this names - error in bold:

/*
 * Multiplies two 4-Bit numbers.
 * The result is therefore 8 bits long.
 * Only use Addierer4 and Identity4.
 */

CHIP Multiplikator4 {
        IN a[4], b[4];
        OUT out[8];

        PARTS:
       
Identity4 (in[0]=b[0], in[1]=b[1], in[2]=b[2], in[3]=b[3], en=a[0], out[0]=out[0], out[1]=out1, out[2]=out2, out[3]=out3);
       
Identity4 (in[0]=b[0], in[1]=b[1], in[2]=b[2], in[3]=b[3], en=a[1], out[0]=out7, out[1]=out6, out[2]=out5, out[3]=out4);
       
Addierer4 (a[0]=out7, a[1]=out6, a[2]=out5, a[3]=out4, b[3]=0, b[2]=out3, b[1]=out2, b[0]=out1, carry=carry1, out[0]=out1, out[1]=out10, out[2]=out9, out[3]=out8);

}

Thank you very much in advance!
Reply | Threaded
Open this post in threaded view
|

Re: A pin name is expected

cadet1620
Administrator
First, although it does not appear to be the case here, the line numbers in error messages are often off by 1 or report the last line in the file; watch out for that.

The "pin name expected" is caused by
    b[3]=0
because 0 is not a pin name.

You want to use the constants true and false for 1 and 0. True and false are special, in that they match any size bus as well as single wires. You can use things like
    x[5..7]=true
if you needed to set those 3 bits to 1.

--Mark

[Please delete your duplicate post in "User's Forum".]
Reply | Threaded
Open this post in threaded view
|

Re: A pin name is expected

CStudent
Thank you very much! It was really helpful - everything works now.

All the best!