def mkLed():
    m = Module('blinkled')
    width = m.Parameter('WIDTH', 8)
    clk = m.Input('CLK')
    rst = m.Input('RST')
    led = m.OutputReg('LED', width)
    count = m.Reg('count', 32)

    m.Always(Posedge(clk))(
        If(rst)(
            count(0)
        ).Else(
            count( Pmux(m, count==1023, 0, count + 1, width=32) )
        ))
    
    m.Always(Posedge(clk))(
        If(rst)(
            led(0)
        ).Else(
            led( Pmux(m, count==1024-1, led+1, led, width=width) )
        ))
    
    return m
dataset/ETHPy150Open PyHDI/veriloggen/tests/core/primitive_mux/primitive_mux.py/mkLed/original