Mux4way16 HDL Syntax Error

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

Mux4way16 HDL Syntax Error

bizobo
"the specified sub bus is not in the bus range"

I keep getting this error and I'm fairly confident it's a syntax error. I don't want to give too much of my solution away, but this error is happening at the third Mux16 gate, when I'm trying to pipe in the output of the other two Mux16 gates. It's happening for this third Mux16 gate's a[16] assignment.

I don't know what this means. Clearly the output of a 16-bit gate is going to be 16-bits. So I should be able to pipe that to the input for another 16-bit gate without a problem - the busses are of equal widths.

But I keep getting this error, unsure of how to deal with it. Yes, I have read Appendix A, several times now, and if the answer is in there I'm not seeing it, so a specific page number would be preferred to "go read Appendix A" as an answer.

Thanks in advance for your help. I've found these forums to be immensely helpful so far. Also, a helpful aside - if you can't see the error message because your file path is too long, just mouse-over the error text and it will pop up in a pop-up window! Huge time saver ^_^
Reply | Threaded
Open this post in threaded view
|

Re: Mux4way16 HDL Syntax Error

ybakos
Keep in mind that each bit in a 16-bit bus is numbered 0 - 15.
Reply | Threaded
Open this post in threaded view
|

Re: Mux4way16 HDL Syntax Error

bizobo
In reply to this post by bizobo
Fixed it with a friend.

The issue was HDL syntax, which seems quite strict and unforgiving. I was not utilizing the Mux16 API correctly. If you keep reading, you may see spoilers! (I've tried to give away as little as possible.)

I was trying to do

Mux16(a[16]=variable[16], b[16]=bvariable[16], sel=thing, out[16]=outvariable[16]);

etc. etc.

The correct call that worked is

Mux16(a=variable[0..15], b=bvariable[0..15], sel=thing, out=outvariable);

Once the internally held Muxes had been generated, no [0..15] was needed. So I had a call that looked like

Mux16(a=variable, b=bvariable, sel=thing, out=out);