| Login | | Don't have an account yet? You can create one. As a registered user you have some advantages like theme manager, comments configuration and post comments with your name. | |
| Who's Online | There are currently, 48 guest(s) and 0 member(s) that are online.
You are Anonymous user. You can register for free by clicking here | |
 | |
|
Verification Guild: Forums |
|
| View previous topic :: View next topic |
| Author |
Message |
ravivlsi Junior


Joined: Jul 22, 2010 Posts: 5
|
Posted: Tue Apr 17, 2012 12:28 am Post subject: inverting multi dimension array in sv |
|
|
I have two dimensional arrays a and b
reg [7:0] a[0:99];
reg [7:0] b[0:99];
and I want to invert entire array by using
b = ~a;
but I got compilation error "bit wise negation, operator operand type is illegal"
Is it possible to invert entire multi dimension array without using loops? |
|
| Back to top |
|
 |
dave_59 Senior


Joined: Jun 22, 2004 Posts: 974 Location: Fremont, CA
|
Posted: Tue Apr 17, 2012 1:39 am Post subject: |
|
|
You can't use bit-wise operators on an unpacked array. If you declared your array as
reg [0:99][7:0] a;
reg [0:99][7:0] b;
Then your statement would work.
You could also cast your array to a packed array value, invert it, then cast it back to an unpacked array
b = unpacked_type'(~ packed_type'(a));
But why not a foreach loop.
foreach(b[i]) b[i] = ~a[i];
Dave Rich
Mentor Graphics |
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
| |
|
|