Meaning of statement/ operation performed in following system verilog code

Status
Not open for further replies.

hulk789

Junior Member level 3
Joined
Jul 18, 2015
Messages
27
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
211
Code:
for (i = 0; i < 8; i = i + 1)
	  begin
	     test[8*i+7-:8] = array[326+i];// What is the operation performed?
	  end
What operation does 8*i+7-:8 perform?
 

Code:
for (i = 0; i < 8; i = i + 1)
	  begin
	     test[8*i+7-:8] = array[326+i];// What is the operation performed?
	  end
What operation does 8*i+7-:8 perform?

This has nothing to do with SV it's straight up 2001 verilog.

The slice defined by:
8*i+7 -:8
results in bytes of a larger bus

and....

Well it's a screwed up way of writing the simpler:
8*i +:8

Basically it's a byte wide slice from a bus taken from the i th byte
e.g.

i=0: eight bits starting from 8*0, 7:0
i=1: eight bits starting from 8*1, 15:8
...
 

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