pkgsrc-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: Update nextpnr, nextpnr-ice40, icestorm



I pushed to wip icestorm_update, nextpnr-ice40_update and nextpnr_update
which update the packages in pkgsrc to the last release|commit. I
asked upstream for a new release of nextpnr, the latest is incompatible
with the last apycula release.

I added py-apycula, py-crc and nextpnr-himbaechel-gowin, so now anyone
interested in making a fpga lab in a budget can do it using netbsd and
opensource and lightweight tools.

A similar package can be created for other nextpnr-himbaechel targets.

Don't forguet to change dependencies' paths if you are going to build these
packages inside wip.

Mini guide:

Build nextpnr-himbaechel-gowin using the updated packages and
install yosys and openFPGALoader.

https://www.aliexpress.com/item/1005003803994525.html (tang nano 9k)
https://wiki.sipeed.com/hardware/en/tang/Tang-Nano-9K/examples/led.html

led.v:
========================
module led (
    input sys_clk,          // clk input
    input sys_rst_n,        // reset input
    output reg [5:0] led    // 6 LEDS pin
);

reg [23:0] counter;

always @(posedge sys_clk or negedge sys_rst_n) begin
    if (!sys_rst_n)
        counter <= 24'd0;
    else if (counter < 24'd1349_9999)       // 0.5s delay
        counter <= counter + 1'b1;
    else
        counter <= 24'd0;
end

always @(posedge sys_clk or negedge sys_rst_n) begin
    if (!sys_rst_n)
        led <= 6'b111110;
    else if (counter == 24'd1349_9999)       // 0.5s delay
        led[5:0] <= {led[4:0],led[5]};
    else
        led <= led;
end

endmodule
========================

led.cst:
========================
IO_LOC "clk" 52;
IO_LOC "led[0]" 10;
IO_LOC "led[1]" 11;
IO_LOC "led[2]" 13;
IO_LOC "led[3]" 14;
IO_LOC "led[4]" 15;
IO_LOC "led[5]" 16;
IO_LOC "rst" 4;
========================

$ yosys -p "read_verilog led.v; synth_gowin -top led -json led.json"
$ nextpnr-himbaechel-gowin --json led.json --write pnrled.json --device GW1NR-LV9QN88PC6/I5 --vopt family=GW1N-9C --vopt cst=led.cst
$ gowin_pack -d GW1N-9C -o led.fs pnrled.json
$ sudo openFPGALoader --scan-usb
$ sudo openFPGALoader --detect
$ sudo openFPGALoader -b tangnano9k -f led.fs

TA-DA!

adr.


Home | Main Index | Thread Index | Old Index