Trouble with an error in hardware simulator

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

Trouble with an error in hardware simulator

Jeff Solin
My students are currently building the ALU.  We are seeing two errors that we are not sure how to handle.  We are trying to use the most significant bit of the output as an input to an And gate and it gives error about connecting gate's output pin to part.  If we change the name of the output so that it is not the final output to the ALU, then the error changes to something regarding a sub bus on an internal node.  I'd like to show the code, but do not want to publicly post anything related to a solution.  I could email someone the code if they are willing to take a peek.  

Thanks,
Jeff
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

gcheong
Hi Jeff,

I would be willing to take a peek. I'm pretty sure I've seen the errors you are describing. I have built the ALU project and got it to pass all tests so I could send you my solution as well.

Cheers,
Greg
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Jeff Solin
Hey Greg. I had replied through the email that was sent to me.  Just wanted to make sure it got to you (with the ALU.hdl attachment).  

Thanks,
Jeff
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Nick
In reply to this post by Jeff Solin
I am also having this problem and receive the error message:

sub bus of an internal node may not be used

Is it actually possible to access bits of internal buses? If so what is the correct syntax?

Thanks,

Nick
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Noam
Section A.5.3 specifies how to handle buses and sub-buses.  The convention in this HDL is that you can connect to arbitrary sub-buses of chips that you use (even with overlap), but that "pins" can not be sub-bused.  

Example: suppose that you have a chip "C" with a 16-bit output bus that you want to connect to a 16-bit pin called sum, but also to use the 7th bit to connect to a 1-bit pin called f, then you simply write:

C(... , out=sum, out[7]=f);
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Nick
Thankyou for the very quick reply, and the explanation.

Regards,

Nick
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Jeff Solin
Thanks Greg and Noam. All is good now.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

ybakos
In reply to this post by Noam
Noam or Shimon,
Could you please explain the reason for this? Is it due to the way internal pins are instantiated by the simulator in Java, or is there an actual hardware reason?

This behavior is considered a little 'inconsistent' by my students, and here is why:

Assume that you have a chip within input interface in[16]. I can subscript in...

Or8Way(in=in[0..7], out=x);

But I can never subscript internal pins.

// assume Add16(a=z,b=y,out=sum); where sum is a 16-bit bus but an internal pin
Or8Way(in=sum[0..7], out=x); // DISALLOWED

Again, I understand the rules (and how to properly subscript a multibit output) but why?

(forgive me, but I've only just started diving into the simulator source code)
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Noam
In retrospect we should have allowed internal pins to be sub-bused too.  Our original reasoning was one of minimality: we are thinking of the internal pins as logically "atomic" within the chip, and this suffices since any pin of an internal chip can be partitioned at will into whatever desired atomic internal pins.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

ybakos
Understood, thanks.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Todun
In reply to this post by Noam
Please can you explain why the internal pins cannot be subscripted. I do not follow the explanation of logical "atomic".

Thanks,
Todun.
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

Sarfraz
In reply to this post by Jeff Solin
Dear Jeff,

I am facing the similar issue as you posted. Can you kindly guide me whats the problem in this piece of code:

CHIP Mux4Way16 {
    IN a[16], b[16], c[16], d[16], sel[2];
    OUT out[16];

    PARTS:
    Mux16(a[0..15]=a[0..15],b[0..15]=b[0..15], sel=sel[0],out[0..15]=out1[0..15]);
    Mux16(a[0..15]=c[0..15],b[0..15]=d[0..15], sel=sel[0],out[0..15]=out2[0..15]);
    Mux16(a[0..15]=out1[0..15],b[0..15]=out2[0..15], sel=sel[1],out[0..15]=out[0..15]);

}
Reply | Threaded
Open this post in threaded view
|

Re: Trouble with an error in hardware simulator

ybakos
Sarfraz, recall that the Mux16 has only two inputs: a and b. You are specifying that Mux16 has 4 inputs, a - d. You can also simplify your HDL. Since the Mux4Way16 inputs and outputs are 16 bits, and the Mux16 has 16 bit inputs and outputs, you can write a=a and out=out1, etc.