Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Verilog syntax question

Status
Not open for further replies.

farklempt

Newbie level 4
Newbie level 4
Joined
Oct 4, 2011
Messages
6
Helped
0
Reputation
0
Reaction score
0
Trophy points
1,281
Activity points
1,321
What does -: and +: mean inside a vector definition
such as:
data[32 -:8]
data[32 +:8]
 

data[32 -:8] -> data[32 : 25] 8 bits starting from bit nr. 32 DOWN
data[32 +:8] -> data[32 : 39] - " - UP
 
maybe I'm wrong
but I think data[32 +:8] does give
data[39 : 32] not data[32 : 39]

at least when data was defined as
reg [39:0] data;

regards
 
  • Like
Reactions: j_andr

    j_andr

    Points: 2
    Helpful Answer Positive Rating
maybe I'm wrong
but I think data[32 +:8] does give
data[39 : 32] not data[32 : 39]

at least when data was defined as
reg [39:0] data;

you are right, my mistake;
J.A
 

but I think data[32 +:8] does give
data[39 : 32] not data[32 : 39]

at least when data was defined as
reg [39:0] data;

It's wrong. Why don't you refer to the Verilog specification, it has clear examples for indexed part select syntax (in IEEE Std 1364-2005, 5.2.1 Vector bit-select and part-select addressing):

Code:
big_vect[ 0 +: 8] // == big_vect[ 7 : 0]
big_vect[15 -: 8] // == big_vect[15 : 8]
little_vect[ 0 +: 8] // == little_vect[0 : 7]
little_vect[15 -: 8] // == little_vect[8 :15]

You see that +: always involves index numbers above the start value.
 
Had to look up the declaration of big_vect and little_vect...

Code:
reg [15:0] big_vect;
reg [0:15] little_vect;

big_vect[ 0 +: 8] // == big_vect[ 7 : 0]
big_vect[15 -: 8] // == big_vect[15 : 8]
little_vect[ 0 +: 8] // == little_vect[0 : 7]
little_vect[15 -: 8] // == little_vect[8 :15]
 

Status
Not open for further replies.

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top