[SOLVED] What does this assignment mean?

Status
Not open for further replies.

rmk423

Newbie level 4
Joined
Sep 1, 2017
Messages
7
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
52
Hi,


Can someone explain the below code please,

a = (b[PARAM1 : PARAM2] == c) && d.var;

Where, PARAM1 & PARAM2 are parameters (say with 1 & 2 values)


Thanks,
RMK
 

(b[PARAM1 : PARAM2] == c)
It takes the vector slice consisting of bits 2 down to 1 of element 'b' and compares it to 'c'.
With == being a Boolean operator - the result is either '0' or '1'.

&& performs a logical AND with 'd.var' and assigns the result to 'a'.
 


Just to add, d is a struct/union whose element var is accesses which is 1 bit signal as well.
 

if you under stand HDLs then b[2:1] is compared to c whose output will be either 1 or 0. Logical AND the result with d.var and then store the result into A.
 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…