Register
Login
Update Profile
Home
About Us
Forum
Tips & Tricks
You are here:
Forum
SVUG Community Forum
Unanswered
Active Topics
Forums
Search
Forums
>
General Discussion
>
Main Discussion Area
Subject: Syntax Help
Prev
Next
You are not authorized to post a reply.
Author
Messages
Oldest First
Newest First
Pradeep
Posts:2
04/13/2010 12:53 PM
Hi All,
I am new to using system verilog and would like to know the behavior of the below code.
for (int i=0; i < 32; i++)
data[i*16+:16] = 16'hFFFF;
What exactly i*16+ mean?
Thanks for your time..
Keith
Posts:6
04/13/2010 2:08 PM
Hello
What it means is that data will be referenced from the starting bit position i*16 up to bit position (i*16) + 16 - 1.
The format for this vector bit part select is [start_pos +: width] which means it references from the start_pos up to the start_pos + width - 1;
If you use the -: then it references the other way of start_pos down to the start_pos - width + 1;
data must be the size of (0
32*16) - 1)
for i = 0 dataΎ:15] is referenced
for i = 1 data⎜:31] is referenced
for i = 2 data⎬:47] is referenced
for i = 3 data⎼:63] is referenced
For reference check out this doc:
http://www.sutherland-hdl.com/online_verilog_ref_guide/verilog_2001_ref_guide.pdf
Check section 6.4
Keith
Posts:6
04/13/2010 2:10 PM
Sorry the formatting got screwed up:
data must be the size ( 0 : ( 32 * 16 ) - 1)
for i = 0 data [ 0 : 15] is referenced
for i = 1 data [ 0 : 31] is referenced
for i = 2 data [ 0 : 47] is referenced
for i = 3 data [ 0 : 63] is referenced
hopefully this works
Keith
Posts:6
04/13/2010 2:10 PM
Sorry messed up again
for i = 0 data [ 0 : 15] is referenced
for i = 1 data [ 16 : 31] is referenced
for i = 2 data [ 32 : 47] is referenced
for i = 3 data [ 48 : 63] is referenced
Pradeep
Posts:2
04/13/2010 3:14 PM
Hi Keith,
Thanks a lot for your explanation..
You are not authorized to post a reply.
General Discussion
--Main Discussion Area
--News & Events
SVUG Archive
--Archive
----Queue as Function/Task Argument (ref)
----How to call Verilog tasks (Test bench) inside a Sy
----Modelling memory
----Ports in Interfaces
----FEM-BEM coupling in ANSYS
----Is semaphore put a task?
----checkpoint vs constraint??
----Hierarchical interfaces
----Using SVA inside classes, a possibility?
----Any suggestions for SVA of Finite State Machine
----What is the process for standardizing base classes
----Looking for reviewers for our new book
----AVM or VMM?
----New to SV
----Interface Wires(??)
----SV modport/clocking block: reading output port
----"Scoreboard" - where did this name come from??
----DPI: passing a list between C and system Verilog
--Cliff-Notes
Forums
>
General Discussion
>
Main Discussion Area
> Syntax Help
ActiveForums 3.7
Copyright 2008 by SystemVerilog User Group
Contact Us
Privacy Statement