Duplication seems to have unexpected behavior

I’m using Alchitry Labs 2.0.13-Preview, with the AU files: alchitryTop.luc, blinker.luc, alchitry.acf and io.acf,

I am seeing unexpected behavior when trying to blink various combinations of the Leds and ioLeds when using “Duplication”.

When I try to set a set of bits within a bit field within an array, the MSB is not set. Am i misunderstanding the syntax?

    led = 8x{myBlinker.blink} // blink LEDs (original line). All 8 Leds blink

    led[3:0] = 4x{myBlinker.blink} // This blinks only the 3 right-most Leds, led[3] is always off
    led[7] = ~myBlinker.blink
    led[6] = ~myBlinker.blink
    led[5] = ~myBlinker.blink
    led[4] = ~myBlinker.blink
            
    ioLed = 3x{{8h00}}
    
    ioLed[2][7] = myBlinker.blink // This blinks the left-most Led of the left-most group of 8 ioLeds 
    
    ioLed[1] = 8x{myBlinker.blink} // This blinks all 8 ioLeds of the middle group of ioLeds
    
    ioLed[0][7:0] = 8x{myBlinker.blink} // This blinks only the 7 right-most ioLeds of the right-most group of ioLeds, ioLed[0][7] is always off

Thanks for reporting this. There was an off-by-one bug in the indexing when converting to Verilog.

It is fixed in the latest commit.

Feel free to open an issue on GitHub for things like this. It helps me keep track of them.

The bug caused anything using the [start:end] syntax to miss the most-significant bit.

Thanks for the confirmation and good to hear it’s been fixed!