微處理器 - Lattice LCMXO2-4000HC-4MG132C (STEP-MXO2 V2) - Verilog - Button



參考資訊:
https://www.stepfpga.com/doc/step-mxo2%E5%85%A5%E9%97%A8%E6%95%99%E7%A8%8B

main.v

module main (
    input btn,
    output reg [7:0] led = 8'b11111110
);

always @(posedge btn) begin
    led <= (led << 1) | 1;

    if (led == 8'b11111111)
        led <= 8'b11111110;
end
     
endmodule

main.lpf

LOCATE COMP "led[0]" SITE "N13";
LOCATE COMP "led[1]" SITE "M12";
LOCATE COMP "led[2]" SITE "P12";
LOCATE COMP "led[3]" SITE "M11";
LOCATE COMP "led[4]" SITE "P11";
LOCATE COMP "led[5]" SITE "N10";
LOCATE COMP "led[6]" SITE "N9";
LOCATE COMP "led[7]" SITE "P9";
LOCATE COMP "btn" SITE "L14";

完成