Is there a better way?

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

Is there a better way?

horhen
Ive been coding (HACK) HDLs for quite sometime now and ive been coding it this way: (example)
RAM16K(
in[0] = in[0],
in[1] = in[1],
in[2] = in[2],
in[3] = in[3],
in[4] = in[4],
in[5] = in[5],
in[6] = in[6],
in[7] = in[7],
in[8] = in[8],
in[9] = in[9],
in[10] = in[10],
in[11] = in[11],
in[12] = in[12],
in[13] = in[13],
in[14] = in[14],
in[15] = in[15],
load = a,
address[0] = address[0],
address[1] = address[1],
address[2] = address[2],
address[3] = address[3],
address[4] = address[4],
address[5] = address[5],
address[6] = address[6],
address[7] = address[7],
address[8] = address[8],
address[9] = address[9],
address[10] =address[10],
address[11] =address[11],
address[12] =address[12],
address[13] =address[13],
out[0] = a0,
out[1] = a1,
out[2] = a2,
out[3] = a3,
out[4] = a4,
out[5] = a5,
out[6] = a6,
out[7] = a7,
out[8] = a8,
out[9] = a9,
out[10] = a10,
out[11] = a11,
out[12] = a12,
out[13] = a13,
out[14] = a14,
out[15] = a15);

My Question is, is there a better way I can connect those 16bit wide lines? Better in a way that I wouldn't have to type each and everyone of them. Is there a way I can specify something like:
RAM16K(
in[0-15] = in[0-15]...etc); ??
Reply | Threaded
Open this post in threaded view
|

Re: Is there a better way?

cadet1620
Administrator
Read Appendix A.5.3.

"RAM16K(in=in" will connect all 16 bits. You can also work with sub-buses. If, for instance, you wanted to swap the top and bottom halves of the in connection you could say "RAM16(in[0..7]=in[8..15], in[8..15]=in[0..7]".

--Mark