Skip to content

Commit 9876054

Browse files
Fix ignition rev2 to a new image. move rev1 to it's own fpga build since
pin defs changed.
1 parent ea24194 commit 9876054

File tree

6 files changed

+148
-12
lines changed

6 files changed

+148
-12
lines changed

.github/workflows/build.yml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,28 @@ jobs:
113113
path: "./buck-out/v2/gen/root/**/*"
114114
- name: Cleanup
115115
run: bash .github/cleanup.sh
116+
cosmo_ignition_r1_only:
117+
needs: changes
118+
if: ${{ needs.changes.outputs.buck2 == 'true' || needs.changes.outputs.cosmo_ignition == 'true' }}
119+
runs-on: self-hosted
120+
steps:
121+
- run: echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
122+
- name: Check out repository code
123+
uses: actions/checkout@v4
124+
with:
125+
submodules: 'true'
126+
- name: Update pip reqs
127+
run : python3 -m pip install --upgrade -r tools/requirements.txt --break-system-packages
128+
- name: buck path
129+
run: echo "~/.cargo/bin:/opt/Xilinx/Vivado/2024.1/bin:/opt/oss-cad-suite-20250211/bin" >> "$GITHUB_PATH"
130+
- name: Build cosmo_ignition bitstream
131+
run: buck2 build //hdl/projects/cosmo_ignition:cosmo_ignition_r1_only --show-output
132+
- uses: actions/upload-artifact@v4
133+
with:
134+
name: cosmo-ignition-r1-only-image
135+
path: "./buck-out/v2/gen/root/**/*"
136+
- name: Cleanup
137+
run: bash .github/cleanup.sh
116138

117139
bsv-streams:
118140
needs: changes

hdl/ip/vhd/i2c/muxes/oximux16/oximux16_function.vhd

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -59,21 +59,21 @@ architecture rtl of oximux16_function is
5959
reg0_pend : control0_type;
6060
data : std_logic_vector(7 downto 0);
6161
enable_allowed : std_logic) return boolean is
62-
variable unrolled_reg : std_logic_vector(15 downto 0);
63-
variable cnt_ones : integer range 0 to 16 := 0;
62+
variable full_reg : unsigned(15 downto 0);
6463
begin
6564
-- allow only writes of 0 even when we're not allowed to enable
6665
if enable_allowed = '0' and (data /= 0 or std_logic_vector'(pack(reg0_pend)) /= 0) then
6766
return false;
6867
end if;
69-
unrolled_reg := data & std_logic_vector'(pack(reg0_pend));
70-
for i in 0 to 15 loop
71-
if unrolled_reg(i) = '1' then
72-
cnt_ones := cnt_ones + 1;
73-
end if;
74-
end loop;
75-
76-
if cnt_ones > 1 then
68+
69+
-- Get the full 16 bit potential value
70+
full_reg := unsigned(data) & unsigned'(pack(reg0_pend));
71+
-- Now check for 1-hotness.
72+
-- Do this by doing x & (x - 1) == 0. Why does this work?
73+
-- binary arith fun: x-1 flips all bits and doing a bitwise AND
74+
-- will remove the lsb that was set.
75+
76+
if (full_reg and (full_reg - 1)) /= 0 then
7777
return false; -- we only allow 1-hot writes to the control registers
7878
end if;
7979
if data(7) = '1' then

hdl/projects/cosmo_ignition/BUCK

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,32 @@ load("//tools:yosys.bzl", "ice40_bitstream")
44

55
vhdl_unit(
66
name = "cosmo_ignition_top",
7-
srcs = glob(["*.vhd"]),
7+
srcs = glob(["*.vhd"], exclude=["cosmo_ignition_r1_top.vhd"]),
88
deps = [
99
"//hdl/ip/vhd/ignition/target:ignition_target_common",
1010
"//hdl/ip/vhd/ignition/target:ignition_io",
1111
],
1212
standard = "2008",
1313
)
1414

15+
vhdl_unit(
16+
name = "cosmo_ignition_r1_top",
17+
srcs = glob(["cosmo_ignition_r1_top.vhd"]),
18+
deps = [
19+
":cosmo_ignition_top",
20+
],
21+
standard = "2008",
22+
)
23+
24+
ice40_bitstream(
25+
name="cosmo_ignition_r1_only",
26+
top_entity_name="cosmo_ignition_r1_top",
27+
top= ":cosmo_ignition_r1_top",
28+
family="hx8k",
29+
package="bg121",
30+
pinmap="cosmo_ignition.pcf"
31+
)
32+
1533
ice40_bitstream(
1634
name="cosmo_ignition",
1735
top_entity_name="cosmo_ignition_top",
Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
-- This Source Code Form is subject to the terms of the Mozilla Public
2+
-- License, v. 2.0. If a copy of the MPL was not distributed with this
3+
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
4+
--
5+
-- Copyright 2025 Oxide Computer Company
6+
7+
-- Cosmo Front Hot-plug FPGA targeting an ice40 HX8k
8+
9+
10+
library ieee;
11+
use ieee.std_logic_1164.all;
12+
use ieee.numeric_std.all;
13+
14+
entity cosmo_ignition_r1_top is
15+
port (
16+
clk_50mhz_ign_trgt_fpga : in std_logic;
17+
ign_trgt_fpga_design_reset_l : in std_logic;
18+
ign_trgt_fpga_debug_led : out std_logic_vector(3 downto 0);
19+
ign_trgt_fpga_spare_v3p3 : out std_logic_vector(7 downto 0);
20+
ign_trgt_id : in std_logic_vector(7 downto 0);
21+
ign_trgt_fpga_lvds_status_led_en_l : out std_logic;
22+
ign_trgt_fpga_pushbutton_reset_l : in std_logic;
23+
lvds_rsw0_to_ign_trgt_fpga_p : inout std_logic;
24+
lvds_ign_trgt_fpga_to_rsw0_p : inout std_logic;
25+
lvds_ign_trgt_fpga_to_rsw0_n : inout std_logic;
26+
lvds_rsw1_to_ign_trgt_fpga_p : inout std_logic;
27+
lvds_ign_trgt_fpga_to_rsw1_p : inout std_logic;
28+
lvds_ign_trgt_fpga_to_rsw1_n : inout std_logic;
29+
v3p3_fpga2_a2_pg : in std_logic;
30+
v1p2_fpga2_a2_pg : in std_logic;
31+
v2p5_fpga2_a2_pg : in std_logic;
32+
main_hsc_restart : out std_logic;
33+
ibc_en : out std_logic;
34+
v5p0_sys_a2_pg : in std_logic;
35+
v3p3_sys_a2_pg : in std_logic;
36+
v1p8_sys_a2_pg : in std_logic;
37+
v1p0_mgmt_a2_pg : in std_logic;
38+
v2p5_mgmt_a2_pg : in std_logic;
39+
v12_sys_a2_pg_l : in std_logic;
40+
main_hsc_pg : in std_logic;
41+
sp_fault_l : in std_logic;
42+
rot_fault_l : in std_logic
43+
44+
);
45+
end entity;
46+
47+
architecture rtl of cosmo_ignition_r1_top is
48+
49+
begin
50+
51+
cosmo_ignition_top_inst: entity work.cosmo_ignition_top
52+
generic map(
53+
IS_REV1 => true
54+
)
55+
port map(
56+
clk_50mhz_ign_trgt_fpga => clk_50mhz_ign_trgt_fpga,
57+
ign_trgt_fpga_design_reset_l => ign_trgt_fpga_design_reset_l,
58+
ign_trgt_fpga_debug_led => ign_trgt_fpga_debug_led,
59+
ign_trgt_fpga_spare_v3p3 => ign_trgt_fpga_spare_v3p3,
60+
ign_trgt_id => ign_trgt_id,
61+
ign_trgt_fpga_lvds_status_led_en_l => ign_trgt_fpga_lvds_status_led_en_l,
62+
ign_trgt_fpga_pushbutton_reset_l => ign_trgt_fpga_pushbutton_reset_l,
63+
lvds_rsw0_to_ign_trgt_fpga_p => lvds_rsw0_to_ign_trgt_fpga_p,
64+
lvds_ign_trgt_fpga_to_rsw0_p => lvds_ign_trgt_fpga_to_rsw0_p,
65+
lvds_ign_trgt_fpga_to_rsw0_n => lvds_ign_trgt_fpga_to_rsw0_n,
66+
lvds_rsw1_to_ign_trgt_fpga_p => lvds_rsw1_to_ign_trgt_fpga_p,
67+
lvds_ign_trgt_fpga_to_rsw1_p => lvds_ign_trgt_fpga_to_rsw1_p,
68+
lvds_ign_trgt_fpga_to_rsw1_n => lvds_ign_trgt_fpga_to_rsw1_n,
69+
v3p3_fpga2_a2_pg => v3p3_fpga2_a2_pg,
70+
v1p2_fpga2_a2_pg => v1p2_fpga2_a2_pg,
71+
v2p5_fpga2_a2_pg => v2p5_fpga2_a2_pg,
72+
main_hsc_restart => main_hsc_restart,
73+
ibc_en => ibc_en,
74+
v5p0_sys_a2_pg => v5p0_sys_a2_pg,
75+
v3p3_sys_a2_pg => v3p3_sys_a2_pg,
76+
v1p8_sys_a2_pg => v1p8_sys_a2_pg,
77+
v1p0_mgmt_a2_pg => v1p0_mgmt_a2_pg,
78+
v2p5_mgmt_a2_pg => v2p5_mgmt_a2_pg,
79+
v12_sys_a2_pg_l => v12_sys_a2_pg_l,
80+
main_hsc_pg => main_hsc_pg,
81+
sp_fault_l => sp_fault_l,
82+
rot_fault_l => rot_fault_l
83+
);
84+
end rtl;

hdl/projects/cosmo_ignition/cosmo_ignition_top.vhd

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,9 @@ use work.ignition_pkg.all;
1515

1616

1717
entity cosmo_ignition_top is
18+
generic (
19+
IS_REV1 : boolean := false
20+
);
1821
port (
1922
clk_50mhz_ign_trgt_fpga : in std_logic;
2023
ign_trgt_fpga_design_reset_l : in std_logic;
@@ -106,7 +109,11 @@ begin
106109
dbg => ign_trgt_fpga_spare_v3p3(4 downto 2)
107110
);
108111

109-
main_hsc_restart <= not hotswap_restart_l;
112+
hsc_gen: if IS_REV1 generate
113+
main_hsc_restart <= not hotswap_restart_l;
114+
else generate
115+
main_hsc_restart <= hotswap_restart_l;
116+
end generate;
110117

111118
ignition_io_inst: entity work.ignition_io
112119
port map(

tools/fpga_releaser/config.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,11 @@ job_name = "cosmo-ignition-image"
99
builder = "buck2"
1010
toolchain = "yosys"
1111

12+
[cosmo-ignition-r1-only]
13+
job_name = "cosmo-ignition-r1-only-image"
14+
builder = "buck2"
15+
toolchain = "yosys"
16+
1217
[cosmo-seq]
1318
job_name = "cosmo-seq-image"
1419
hubris_path = "drv/spartan7-loader/cosmo-seq"

0 commit comments

Comments
 (0)