开源工具链学习

Posted on Fri, Sep 26, 2025 单片机 VHDL

https://github.com/YosysHQ/oss-cad-suite-build?tab=readme-ov-file#installation

OSS CAD Suite

Introduction

OSS CAD Suite is a binary software distribution for a number of open source software used in digital logic design. You will find tools for RTL synthesis, formal hardware verification, place & route, FPGA programming, and testing with support for HDLs like Verilog, Migen, and Amaranth.

OSS CAD Suite is a component of YosysHQ's Tabby CAD Suite:

See Tabby CAD Datasheet for details on Tabby CAD Suite; see OSS CAD Suite GitHub (this page) for details on OSS CAD Suite.

RTL Synthesis

Did you know that the Tabby CAD version of yosys supports industry standard SystemVerilog, VHDL and SVA? Contact us at contact@yosyshq.com to arrange a free evaluation license.

Plugins

Formal Tools

PnR (Place and Route)

FPGA board programming tools

Simulation/Testing

Support libraries

Installation

  1. Download an archive matching your OS from the releases page.
  2. Extract the archive to a location of your choice (for Windows it is recommended that path does not contain spaces)
  3. On macOS to allow execution of quarantined files xattr -d com.apple.quarantine oss-cad-suite-darwin-x64-yyymmdd.tgz on downloaded file, or run: ./activate in extracted location once.
  4. Set the environment as described below.

Linux and macOS

export PATH="<extracted_location>/oss-cad-suite/bin:$PATH"

# or

source <extracted_location>/oss-cad-suite/environment

Linux and macOS (fish shell)

fish_add_path "<extracted_location>/oss-cad-suite/bin"

# or

source <extracted_location>/oss-cad-suite/environment.fish

Windows

from existing CMD prompt:
<extracted_location>\\oss-cad-suite\\environment.bat

from existing PowerShell prompt:
. <extracted_location>\\oss-cad-suite\\environment.ps1

to create new CMD prompt:
<extracted_location>\\oss-cad-suite\\start.bat

NOTE: when environment is set, python3 from package becomes available as well, this enables usage of Migen and Amaranth HDL and LiteX libraries scripts as usual. When OSS CAD Suite is just added in PATH to use packaged python3 use tabbypy3 to start python environment. For Windows, there are no wrappers and using environment.bat is only choice.

Using LiteX

We provide you with Python 3.11 and all required software to be able to use LiteX. After activating environment it is possible to perform installation same as usual:

mkdir -p litex
cd litex
wget <https://raw.githubusercontent.com/enjoy-digital/litex/master/litex_setup.py>
python3 litex_setup.py init
python3 litex_setup.py install

嵌入式ARM RISV

Openocd

wezterm 配置文件

-- 引入 wezterm API
local wezterm = require("wezterm")
local act = wezterm.action
-- 初始化 config
local config = wezterm.config_builder()

-- ===== 默认启动 PowerShell Core =====
config.default_prog = { "pwsh.exe", "-NoLogo" }
-- 如果要用 Windows PowerShell 5.x:
-- config.default_prog = { "powershell.exe", "-NoLogo" }

-- ===== 启动菜单 =====
config.launch_menu = {
	{ label = "WSL Arch 🤓", args = { "wsl.exe", "-d", "Arch" } }, -- 换成你的发行版名
	{
		label = "OFPGA",
		args = {
			"pwsh.exe",
			"-NoLogo",
			"-NoExit", -- 保证执行完不自动关闭窗口
			"-Command",
			". '.\\environment.ps1'", -- 注意:双引号和转义
		},
		cwd = "E:/oss-cad-suite",
	},
	{ label = "Windows PowerShell", args = { "powershell.exe", "-NoLogo" } },
	{ label = "PowerShell Core", args = { "pwsh.exe", "-NoLogo" } },
	{ label = "Command Prompt", args = { "cmd.exe" } },
}

-- ===== 颜色主题 =====
local scheme = wezterm.get_builtin_color_schemes()["Bamboo"]
config.color_scheme = "Bamboo"

-- config.use_fancy_tab_bar = false
config.use_fancy_tab_bar = false
config.exit_behavior = "CloseOnCleanExit"
config.show_new_tab_button_in_tab_bar = false
config.colors = {
	tab_bar = {
		-- 避免某些版本没有 bg_trans
		background = scheme.background or "#0b0b0b",
		new_tab = { bg_color = "#B5D0C0", fg_color = scheme.ansi[8], intensity = "Bold" },
		new_tab_hover = { bg_color = scheme.ansi[1], fg_color = scheme.brights[8], intensity = "Bold" },
		active_tab = { bg_color = "#27850b", fg_color = "#FCE8C3", intensity = "Bold" },
		inactive_tab = { bg_color = scheme.ansi[2], fg_color = "#FCE8C3" },
		inactive_tab_hover = { bg_color = scheme.ansi[1], fg_color = "#FCE8C3" },
	},
}

-- ===== 外观与字体 =====
config.window_decorations = "RESIZE"
-- config.window_decorations = "TITLE|RESIZE"
-- config.tab_bar_at_bottom = true
config.hide_tab_bar_if_only_one_tab = true

config.font_size = 12
config.font = wezterm.font_with_fallback({
	"Maple Mono NF CN",
	"JetBrains Mono",
})
config.window_frame = {
	font = wezterm.font({ family = "Maple Mono NF CN", weight = "ExtraLight" }),
	inactive_titlebar_bg = "#000000",
	active_titlebar_bg = "none",
	font_size = 10,
}

config.initial_cols = 140
config.initial_rows = 80
config.window_background_opacity = 0.44
config.window_padding = {
	left = 20,
	right = 20,
	top = 6,
	bottom = 5,
}

-- ===== 快捷键 =====
config.leader = { key = "a", mods = "CTRL", timeout_milliseconds = 1000 }

config.keys = {
	-- 切换透明度
	{ key = "O", mods = "CTRL|SHIFT", action = act.EmitEvent("toggle-opacity") },

	-- 新标签启动 pwsh
	{
		key = "t",
		mods = "SHIFT",
		action = act.SpawnCommandInNewTab({ args = { "pwsh.exe", "-NoLogo" }, cwd = "D:/Desktop" }),
	},

	-- Ctrl+Tab 切换标签
	{ key = "Tab", mods = "CTRL", action = act.ActivateTabRelative(1) },
	-- Ctrl+Shift+W 关闭当前 Tab(无确认)
	{ key = "c", mods = "ALT", action = act.CloseCurrentTab({ confirm = true }) },
	-- Ctrl+Shift+X 关闭当前 Pane(无确认)
	{ key = "x", mods = "ALT", action = act.CloseCurrentPane({ confirm = true }) },
	-- Leader + q 关闭 Tab(Vim 风格)

	{
		key = "|",
		mods = "ALT|SHIFT",
		action = act.SplitHorizontal({ domain = "CurrentPaneDomain", args = { "pwsh.exe", "-NoLogo" } }),
	},
	{ key = "-", mods = "ALT", action = act.SplitVertical({ domain = "CurrentPaneDomain" }) },
	-- Leader + 字体大小调整
	{ key = "=", mods = "CTRL", action = act.IncreaseFontSize },
	{ key = "-", mods = "CTRL", action = act.DecreaseFontSize },
	-- Leader + h/j/k/l 切换 Pane
	{ key = "h", mods = "SHIFT", action = act.ActivatePaneDirection("Left") },
	{ key = "l", mods = "SHIFT", action = act.ActivatePaneDirection("Right") },
	{ key = "k", mods = "SHIFT", action = act.ActivatePaneDirection("Up") },
	{ key = "j", mods = "SHIFT", action = act.ActivatePaneDirection("Down") },
	{ key = "l", mods = "ALT", action = act.ShowLauncherArgs({ flags = "LAUNCH_MENU_ITEMS" }) },
}

-- Alt+数字 切换对应标签(Alt+1 → 第1个,Alt+2 → 第2个 ... Alt+9)
for i = 1, 9 do
	table.insert(config.keys, {
		key = tostring(i),
		mods = "ALT",
		action = act.ActivateTab(i - 1),
	})
end

-- ===== 自定义事件 =====
-- 切换透明度
wezterm.on("toggle-opacity", function(window)
	local overrides = window:get_config_overrides() or {}
	if not overrides.window_background_opacity then
		overrides.window_background_opacity = 1.0
	else
		overrides.window_background_opacity = nil
	end
	window:set_config_overrides(overrides)
end)

-- 窗口启动居中
wezterm.on("gui-startup", function(cmd)
	local screen = wezterm.gui.screens().active
	local width = math.floor(screen.width * 0.75)
	local height = math.floor(screen.height * 0.75)

	local tab, pane, win = wezterm.mux.spawn_window(cmd or {
		position = {
			x = math.floor((screen.width - width) / 2),
			y = math.floor((screen.height - height) / 2),
			origin = { Named = screen.name },
		},
	})
	win:gui_window():set_inner_size(width, height)
end)

-- 返回配置
return config