본문 바로가기
일/Knowledge

indexed part-select (Verilog 2001 => +: )

by 멜랑멀리 2016. 5. 20.
SMALL

 

logic [31: 0] a_vect;
logic
[0 :31] b_vect;

logic [63: 0] dword;
integer sel;

a_vect
[ 0 +: 8] // == a_vect[ 7 : 0]
a_vect
[15 -: 8] // == a_vect[15 : 8]
b_vect
[ 0 +: 8] // == b_vect[0 : 7]
b_vect
[15 -: 8] // == b_vect[8 :15]

for(i=0;i<4;i=i+1)
    dword
[8*sel +: 8] // variable part-select with fixed width

 

(i=0) => dword[7:0]

(i=1) => dword[15:8]

(i=2) => dword[23:16]

(i=3) => dword[31:24]

 

 

 

a_vect[x +: y] => [ x + y -1 : x ]

a_vect[x -: y] => [ x : x - y + 1 ]

 

 

 

LIST

' > Knowledge' 카테고리의 다른 글

ready valid protocol 설명. ( verilog )  (0) 2016.11.09
median-cut  (1) 2016.06.15
xilinx - Content-Addressable Memory ( CAM )  (0) 2016.04.20
xilinx - quad port ram  (0) 2016.04.20
CRC verilog / VHDL  (0) 2016.04.15