|
:6502 :alienware :bootfloppy :circdraw :d11amp :daes :deadline :dettuxx :detLFS :dhex :drm :dMagnetic :fpga_stuff :inhouse :LOGIX :n2048 :nInvaders :nmicrocoder :photos :papers :qdslconfig :systemc :tutorials :xf86config :math winscp.exe putty.exe :impressum |
FPGA STUFFThis page is about my interest in FPGA design. It is sooo much fun!2026-06-13: FPGA design on OpenBSD 7.9Ever wanted to design FPGAs whilst running OpenBSD 7.9? Now you can! I have recently purchased an Olimex GateMateA1-EVB.It was rather reasonably priced, and the required toolchain was compiling with little modification on my OpenBSD machine. With a little bit of luck, when you are reading this, you might be able to install them by typing in pkg_add prjpeppercorn nextpnr openfpgaloader yosys-takeover Hello World exampleA total of four files are needed:- olimex_gatematea1-evb_cc.ccf for the input/output connection. - helloworld.v for the actual design. - 1_synth.sh to synthesize the bitstream. - 2_program.sh to program the board with the bitstream. olimex_gatematea1-evb_c.ccfNet "clk" Loc = "IO_SB_A8" | SCHMITT_TRIGGER=true; Net "btn" Loc = "IO_SB_B7"; Net "led" Loc = "IO_SB_B6"; # Led D1 Closer inspection of the board schematic reveals, that the main clock is connected to pin IO_SB_A8. And a LED to pin IO_SB_B6. The intended way to give those pins names, which can be used in designs, is to place them in a .ccf file. helloworld.v
module top(
input clk, // connected to pin IO_SB_A8
output wire led // connected to pin IO_SB_B6
);
reg [23:0] counter=0;
always @(posedge clk)
begin
counter<=counter+1;
end
assign led=counter[23];
endmodule
This verilog file is a toplevel. Its input and output are directly connected to the pins via the names clk and led.1_synth.sh#!/bin/sh echo "running yosys..." yosys -p "read_verilog helloworld.v ; synth_gatemate -top top -luttree -nomx8 ; write_json helloworld_netlist.json ; write_verilog helloworld_netlist.v" echo "running nextpnr..." nextpnr-himbaechel --device=CCGM1A1 --json helloworld_netlist.json -o ccf=olimex_gatematea1-evb_c.ccf -o out=helloworld_bitstream.txt --router router2 echo "running gmpack (from prjpeppercorn)..." gmpack helloworld_bitstream.txt helloworld.bitThis shell script synthesizes the bitstream. 2_program.sh#!/bin/sh doas openFPGALoader --index-chain 0 --cable dirtyJtag helloworld.bitThis shell script programs the FPGA board. If all went well, the LED on the board should blink at a leisurely pace. |