UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Observer townsend
Observer
357 Views
Registered: ‎02-08-2019

using two concatenated sources for one module argument

Jump to solution

'sorry, but I'm a newbie here and I probably haven't worded things appropraitely in the subject line, but that's the best description I could come up with. Suppose I have a module and one of its input arguments is an eight bit value, but I use it in an application where the eight bit value I want to include there is comming from two four bit items. i.e. the module argument is expected to be, say, a byte X which is wire[7:0], but I have two separate nybles, A and B that are both wire[3:0]. How would I include these two arguments (say A is the MSNyble and B is the LSNyble) to represent the "byte" argument. What is the correct syntax to concatenate A and B to represent the argument X when I use the module?

-gt-

 

0 Kudos
1 Solution

Accepted Solutions
Highlighted
Teacher xilinxacct
Teacher
284 Views
Registered: ‎10-23-2018

Re: using two concatenated sources for one module argument

Jump to solution

@townsend

Yes, the { } are the concatination operator... you don't have to use it in conjunction with the assign... anywhere, there is syntactically correct, sould be fine.

Hope that helps

If so, please mark as solution accepted. Kudos also welcomed. :-)

3 Replies
Teacher xilinxacct
Teacher
319 Views
Registered: ‎10-23-2018

Re: using two concatenated sources for one module argument

Jump to solution

@townsend

I think this is what you are looking for.... 

assign w_CAT = {r_VAL_1, r_VAL_2};

Hope that helps

If so, please mark as solution accepted. Kudos also welcomed. :-)

0 Kudos
Observer townsend
Observer
297 Views
Registered: ‎02-08-2019

Re: using two concatenated sources for one module argument

Jump to solution

Does verilog allow that notation to be used anonomously, or does it have to ba named? In other words, can I toss just the "{r_VAL_1, r_VAL_2}" right into the place where I want the concatenated result (i.e. in the argument list of the module when I invoke it) or do I have to assign it to w_CAT to give it a name and put that into the argument list instead? It wouldbe nice if it works anonomously, otherwise I have to make up a new thing (i.e. w_CAT) to worry about.

-gt-

 

0 Kudos
Highlighted
Teacher xilinxacct
Teacher
285 Views
Registered: ‎10-23-2018

Re: using two concatenated sources for one module argument

Jump to solution

@townsend

Yes, the { } are the concatination operator... you don't have to use it in conjunction with the assign... anywhere, there is syntactically correct, sould be fine.

Hope that helps

If so, please mark as solution accepted. Kudos also welcomed. :-)