cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
gdlaende
Visitor
Visitor
302 Views
Registered: ‎10-18-2018

Parallel access to flags register

I am currently facing two issues in my HLS design for which I don't seem to find an answer online:

(i) I want to read from/write to a 32-bit "flags" register (implemented as an ap_uint) in parallel, where each loop iteration i only  should only access the i-th bit of the "flags" register.

(ii) Within each iteration, I want to be able to read the initial value of the "flags" register, even if I have already overwritten this value in the current iteration (when interpreted in a purely sequential manner).

The code below illustrates this:

ap_uint<32> flags = 0x0123abcd;

for(int i = 0; i < 32; i++) {
    #pragma HLS unroll

    if(<...>)
        flags.set(i)

    if(flags.test(i)) // Here I want the 'initial' value
	<...>
}

 

For (i), I am considering the use of #pragma HLS dependence variable=flags inter false, but I am unsure whether this pragma will work at a bit-level granularity.

For (ii), I am looking at the #pragma HLS dependence variable=flags intra WAR true, which I found here. Again, I am not sure whether this will work at the bit-level, especially taking into account that the other bits of the flags register may have changed already. 

Can someone point me in the right direction for this? An alternative would be to use an ap_uint<1> flags[32] array, but this would hinder processing after the for-loop, as I intend to do some boolean magic with the flags. Thanks in advance. 

0 Replies