From 9ecaa33b4a52f843378aacd8ddd20998dce31982 Mon Sep 17 00:00:00 2001 From: Palle Ravn <1831737+paller@users.noreply.github.com> Date: Fri, 28 Feb 2025 19:07:59 +0100 Subject: [PATCH] Add iCESugar-nano board Follow the 6 steps to add support for a new target. Step 1: Locate input and output pins. Step 2: Add pin constraint file. This covers clock input, LED and UART output. Step 3: Create a clock generator. The chip has no internal clock generator so the external 12 MHz clock is used. Step 4: Add top level servant_ice40_cm36 which connects the one-wire output of servant to both the LED and UART pin. Step 5: Add fileset including the new top level and pin constraints. Step 6: Add target icesugar-nano. --- data/icesugar_nano.pcf | 8 ++++++++ servant.core | 16 ++++++++++++++++ servant/servant_ice40_cm36.v | 34 ++++++++++++++++++++++++++++++++++ 3 files changed, 58 insertions(+) create mode 100644 data/icesugar_nano.pcf create mode 100644 servant/servant_ice40_cm36.v diff --git a/data/icesugar_nano.pcf b/data/icesugar_nano.pcf new file mode 100644 index 00000000..c4d5c4ad --- /dev/null +++ b/data/icesugar_nano.pcf @@ -0,0 +1,8 @@ +# 12 MHz external clock +set_io i_clk D1 + +# LED +set_io o_led B6 + +# UART +set_io o_uart_tx B3 diff --git a/servant.core b/servant.core index 901250fc..9a36783e 100644 --- a/servant.core +++ b/servant.core @@ -156,6 +156,11 @@ filesets: icesugar : {files: [data/icesugar.pcf : {file_type : PCF}]} + icesugar_nano: + files: + - data/icesugar_nano.pcf : {file_type : PCF} + - servant/servant_ice40_cm36.v : {file_type : verilogSource} + icev_wireless : {files: [data/icev_wireless.pcf : {file_type : PCF}]} gmm7550: @@ -440,6 +445,17 @@ targets: pnr: next toplevel : service + icesugar-nano: + default_tool : icestorm + description : iCE40LP1K Development Board by MuseLab + filesets : [mem_files, soc, icesugar_nano] + parameters : [memfile=blinky.hex, memsize=7168] + tools: + icestorm: + nextpnr_options: [--lp1k, --package, cm36, --freq, 12] + pnr: next + toplevel : servant_ice40_cm36 + icev_wireless: default_tool : icestorm description: ICE-V Wireless diff --git a/servant/servant_ice40_cm36.v b/servant/servant_ice40_cm36.v new file mode 100644 index 00000000..27db148a --- /dev/null +++ b/servant/servant_ice40_cm36.v @@ -0,0 +1,34 @@ +`default_nettype none +module servant_ice40_cm36 ( + input wire i_clk, + output wire o_led, + output wire o_uart_tx +); + + parameter memfile = "blinky.hex"; + parameter memsize = 7168; + + wire wb_clk; + wire wb_rst; + wire q; + + /* Duplicate the SERV output to both LED and UART pins. */ + assign o_led = q; + assign o_uart_tx = q; + + /* iCE40 CM36 has no PLL. Drive everything from the external clock. */ + assign wb_clk = i_clk; + + /* Board has no button that can be used for reset. */ + assign wb_rst = 1'b0; + + servant #( + .memfile(memfile), + .memsize(memsize) + ) servant ( + .wb_clk(wb_clk), + .wb_rst(wb_rst), + .q (q) + ); + +endmodule