Skip to content

Commit 2849917

Browse files
Merge pull request #741 from trabucayre/brs_100_gw1nr9
brisbaneSilicon BRS-100 GW1NR9
2 parents 87307de + 33751ce commit 2849917

4 files changed

Lines changed: 191 additions & 0 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -123,6 +123,7 @@ Some of the supported boards, see yours? Give LiteX-Boards a try!
123123
├── berkeleylab_marble
124124
├── berkeleylab_obsidian
125125
├── bochenjingxin_kintex7_basec
126+
├── brisbaneSilicon_brs_100_gw1nr9
126127
├── camlink_4k
127128
├── colognechip_gatemate_evb
128129
├── colorlight_5a_75x

docs/boards_inventory.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ python3 .github/scripts/generate_board_inventory.py --write
3737
| `berkeleylab_marble` | berkeleylab_marble | vivado | `125000000.0` | Ethernet, Etherbone | included |
3838
| `berkeleylab_obsidian` | berkeleylab_obsidian | vivado | `125000000.0` | Ethernet, Etherbone | included |
3939
| `bochenjingxin_kintex7_basec` | bochenjingxin_kintex7_basec | vivado | `125000000.0` | - | included |
40+
| `brisbaneSilicon_brs_100_gw1nr9` | brisbaneSilicon_brs_100_gw1nr9 | gowin | `27000000.0` | - | included |
4041
| `camlink_4k` | camlink_4k | trellis | `81000000.0` | - | included |
4142
| `colognechip_gatemate_evb` | colognechip_gatemate_evb | colognechip | `24000000.0` | SDCard, SPI SDCard, SPI Flash | included |
4243
| `colorlight_5a_75x` | colorlight_5a_75b, colorlight_5a_75e, colorlight_i5a_907 | trellis | `60000000.0` | Ethernet, Etherbone, SPI Flash | included |
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
#
2+
# This file is part of LiteX-Boards.
3+
#
4+
# Copyright (c) 2026 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
5+
# SPDX-License-Identifier: BSD-2-Clause
6+
7+
from migen import *
8+
9+
from litex.build.generic_platform import *
10+
from litex.build.gowin.platform import GowinPlatform
11+
from litex.build.openfpgaloader import OpenFPGALoader
12+
13+
14+
# IOs ----------------------------------------------------------------------------------------------
15+
16+
_io = [
17+
# Clk / Rst
18+
("clk27", 0, Pins("52"), IOStandard("LVCMOS33"), Misc("PULL_MODE=UP")),
19+
20+
# Leds
21+
("user_led_n", 0, Pins("16"), Misc("PULL_MODE=UP DRIVE=8")),
22+
("user_led_n", 1, Pins("15"), Misc("PULL_MODE=UP DRIVE=8")),
23+
("user_led_n", 2, Pins("14"), Misc("PULL_MODE=UP DRIVE=8")),
24+
("user_led_n", 3, Pins("13"), Misc("PULL_MODE=UP DRIVE=8")),
25+
("user_led_n", 4, Pins("11"), Misc("PULL_MODE=UP DRIVE=8")),
26+
("user_led_n", 5, Pins("10"), Misc("PULL_MODE=UP DRIVE=8")),
27+
28+
# Buttons
29+
("user_btn_n", 0, Pins("3"), Misc("PULL_MODE=UP")),
30+
("user_btn_n", 1, Pins("4"), Misc("PULL_MODE=UP")),
31+
32+
# Serial
33+
("serial", 0,
34+
Subsignal("rx", Pins("18"), Misc("PULL_MODE=UP")),
35+
Subsignal("tx", Pins("17"), Misc("PULL_MODE=UP DRIVE=8")),
36+
IOStandard("LVCMOS33")
37+
),
38+
39+
# SPIFlash
40+
("spiflash", 0,
41+
Subsignal("cs_n", Pins("60"), Misc("PULL_MODE=UP DRIVE=8")),
42+
Subsignal("clk", Pins("59"), Misc("PULL_MODE=UP DRIVE=8")),
43+
Subsignal("miso", Pins("62"), Misc("PULL_MODE=UP")),
44+
Subsignal("mosi", Pins("61"), Misc("PULL_MODE=UP DRIVE=8")),
45+
IOStandard("LVCMOS33"),
46+
),
47+
48+
# PSRAM
49+
("O_psram_ck", 0, Pins(2)),
50+
("O_psram_ck_n", 0, Pins(2)),
51+
("O_psram_cs_n", 0, Pins(2)),
52+
("O_psram_reset_n", 0, Pins(2)),
53+
("IO_psram_dq", 0, Pins(16)),
54+
("IO_psram_rwds", 0, Pins(2)),
55+
]
56+
57+
# Connectors ---------------------------------------------------------------------------------------
58+
59+
_connectors = [
60+
["J5", "25 26 27 28 29 30 33 34 35 36 37 38 39 40 41 42"],
61+
["J6", "77 76 75 74 73 72 71 70 69 68 57 56 55 54 53 51"],
62+
]
63+
64+
# Platform -----------------------------------------------------------------------------------------
65+
66+
class Platform(GowinPlatform):
67+
default_clk_name = "clk27"
68+
default_clk_period = 1e9/27e6
69+
70+
def __init__(self, toolchain="gowin"):
71+
GowinPlatform.__init__(self, "GW1NR-LV9QN88PC7/I6", _io, _connectors, toolchain=toolchain, devicename="GW1NR-9C")
72+
self.toolchain.options["use_mspi_as_gpio"] = 1
73+
self.toolchain.options["use_sspi_as_gpio"] = 1
74+
75+
def create_programmer(self):
76+
return OpenFPGALoader("brs-100-gw1nr9")
77+
78+
def do_finalize(self, fragment):
79+
GowinPlatform.do_finalize(self, fragment)
80+
self.add_period_constraint(self.lookup_request("clk27", loose=True), 1e9/27e6)
Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
#!/usr/bin/env python3
2+
3+
#
4+
# This file is part of LiteX-Boards.
5+
#
6+
# Copyright (c) 2026 Gwenhael Goavec-Merou <gwenhael.goavec-merou@trabucayre.com>
7+
# SPDX-License-Identifier: BSD-2-Clause
8+
9+
import os
10+
from migen import *
11+
12+
from litex.gen import *
13+
14+
from litex_boards.platforms import brisbaneSilicon_brs_100_gw1nr9
15+
16+
from litex.soc.cores.clock.gowin_gw1n import GW1NPLL
17+
from litex.soc.integration.soc_core import *
18+
from litex.soc.integration.soc import SoCRegion
19+
from litex.soc.integration.builder import *
20+
from litex.soc.cores.led import LedChaser
21+
22+
from litex.soc.cores.hyperbus import HyperRAM
23+
24+
# CRG ----------------------------------------------------------------------------------------------
25+
26+
class _CRG(LiteXModule):
27+
def __init__(self, platform, sys_clk_freq):
28+
self.rst = Signal()
29+
self.cd_sys = ClockDomain()
30+
31+
# # #
32+
33+
# Clk / Rst
34+
clk27 = platform.request("clk27")
35+
rst_n = platform.request("user_btn_n", 0)
36+
37+
# PLL
38+
self.pll = pll = GW1NPLL(devicename=platform.devicename, device=platform.device)
39+
self.comb += pll.reset.eq(~rst_n)
40+
pll.register_clkin(clk27, 27e6)
41+
pll.create_clkout(self.cd_sys, sys_clk_freq)
42+
43+
# BaseSoC ------------------------------------------------------------------------------------------
44+
45+
class BaseSoC(SoCCore):
46+
def __init__(self, toolchain="gowin", sys_clk_freq=27e6, bios_flash_offset=0x0,
47+
with_led_chaser = True,
48+
**kwargs):
49+
platform = brisbaneSilicon_brs_100_gw1nr9.Platform(toolchain=toolchain)
50+
51+
# CRG --------------------------------------------------------------------------------------
52+
self.crg = _CRG(platform, sys_clk_freq)
53+
54+
# SoCCore ----------------------------------------------------------------------------------
55+
# Disable Integrated ROM.
56+
kwargs["integrated_rom_size"] = 0
57+
SoCCore.__init__(self, platform, sys_clk_freq, ident="LiteX SoC on BrisbaneSilicon BRS-100-GW1NR9", **kwargs)
58+
59+
# SPI Flash --------------------------------------------------------------------------------
60+
from litespi.modules import P25Q32H
61+
from litespi.opcodes import SpiNorFlashOpCodes as Codes
62+
self.add_spi_flash(mode="1x", module=P25Q32H(Codes.READ_1_1_1), with_master=False)
63+
64+
# Add ROM linker region --------------------------------------------------------------------
65+
self.bus.add_region("rom", SoCRegion(
66+
origin = self.bus.regions["spiflash"].origin + bios_flash_offset,
67+
size = 64 * KILOBYTE,
68+
linker = True)
69+
)
70+
self.cpu.set_reset_address(self.bus.regions["rom"].origin)
71+
72+
# Leds -------------------------------------------------------------------------------------
73+
if with_led_chaser:
74+
self.leds = LedChaser(
75+
pads = platform.request_all("user_led_n"),
76+
sys_clk_freq = sys_clk_freq)
77+
78+
# Build --------------------------------------------------------------------------------------------
79+
80+
def main():
81+
from litex.build.parser import LiteXArgumentParser
82+
parser = LiteXArgumentParser(platform=brisbaneSilicon_brs_100_gw1nr9.Platform, description="LiteX SoC on BrisbaneSilicon BRS-100-GW1NR9.")
83+
parser.add_target_argument("--flash", action="store_true", help="Flash bitstream and BIOS.")
84+
parser.add_target_argument("--sys-clk-freq", default=27e6, type=float, help="System clock frequency.")
85+
parser.add_target_argument("--bios-flash-offset", default="0x0", help="BIOS offset in SPI Flash.")
86+
args = parser.parse_args()
87+
88+
soc = BaseSoC(
89+
toolchain = args.toolchain,
90+
sys_clk_freq = args.sys_clk_freq,
91+
bios_flash_offset = int(args.bios_flash_offset, 0),
92+
**parser.soc_argdict
93+
)
94+
95+
builder = Builder(soc, **parser.builder_argdict)
96+
if args.build:
97+
builder.build(**parser.toolchain_argdict)
98+
99+
if args.load:
100+
prog = soc.platform.create_programmer()
101+
prog.load_bitstream(builder.get_bitstream_filename(mode="sram"))
102+
103+
if args.flash:
104+
prog = soc.platform.create_programmer()
105+
prog.flash(0, builder.get_bitstream_filename(mode="flash", ext=".fs"))
106+
prog.flash(int(args.bios_flash_offset, 0), builder.get_bios_filename(), external=True)
107+
108+
if __name__ == "__main__":
109+
main()

0 commit comments

Comments
 (0)