Skip to content

Commit 98d3b96

Browse files
Initial cosmo hp implementation
1 parent a8fd86b commit 98d3b96

File tree

5 files changed

+11297
-422
lines changed

5 files changed

+11297
-422
lines changed

hdl/projects/cosmo_hp/BUCK

+4
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ load("//tools:yosys.bzl", "ice40_bitstream")
44
vhdl_unit(
55
name = "cosmo_hp_top",
66
srcs = glob(["*.vhd"]),
7+
deps = [
8+
"//hdl/ip/vhd/synchronizers:async_reset_bridge",
9+
"//hdl/ip/vhd/spi/axi_controller:spi_axi_controller",
10+
],
711
standard = "2008",
812
)
913

hdl/projects/cosmo_hp/cosmo_hp_top.vhd

+68-6
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,9 @@
22
-- License, v. 2.0. If a copy of the MPL was not distributed with this
33
-- file, You can obtain one at https://mozilla.org/MPL/2.0/.
44
--
5-
-- Copyright 2024 Oxide Computer Company
5+
-- Copyright 2025 Oxide Computer Company
66

77
-- Cosmo Front Hot-plug FPGA targeting an ice40 HX8k
8-
-- Pin names snapshot from 20Nov2024
98

109

1110
library ieee;
@@ -17,7 +16,6 @@ entity cosmo_hp_top is
1716
port (
1817
clk_50mhz_fpga2: in std_logic;
1918
sp_to_fpga2_system_reset_l: in std_logic;
20-
2119
-- CEM A
2220
cema_to_fpga2_alert_l : in std_logic;
2321
cema_to_fpga2_ifdet_l : in std_logic;
@@ -137,7 +135,7 @@ entity cosmo_hp_top is
137135
-- MCIO I/F
138136
v12_mcio_a0hp_pg: in std_logic;
139137
fpga2_to_mcio_perst_l: out std_logic;
140-
fpga2_to_mcio_prpe: out std_logic;
138+
fpga2_to_mcio_prpe: in std_logic; -- TODO, confirm Hi-Z works with yosys + ghdl
141139
fpga2_to_v12_mcio_a0hp_hsc_en: out std_logic;
142140
-- FPGA1 I/F
143141
fpga1_to_fpga2_io: in std_logic_vector(5 downto 0);
@@ -148,7 +146,7 @@ entity cosmo_hp_top is
148146
fpga2_to_sp_int_l: in std_logic_vector(2 downto 0); -- 3..1 in sch
149147
smbus_sp_to_fpga2_smclk: inout std_logic;
150148
smbus_sp_to_fpga2_smdat: inout std_logic;
151-
spi_fpga2_to_sp_mux_dat: in std_logic;
149+
spi_fpga2_to_sp_mux_dat: out std_logic;
152150
spi_sp_mux_to_fpga2_cs_l : in std_logic;
153151
spi_sp_mux_to_fpga2_dat : in std_logic;
154152
spi_sp_mux_to_fpga2_sck : in std_logic;
@@ -170,7 +168,71 @@ entity cosmo_hp_top is
170168
end entity;
171169

172170
architecture rtl of cosmo_hp_top is
173-
171+
signal led_blink_cntr: unsigned(24 downto 0) := (others => '0');
172+
signal reset_50m: std_logic;
174173
begin
175174

175+
-- Reset synchronizer
176+
clk125m_sync: entity work.async_reset_bridge
177+
generic map(
178+
async_reset_active_level => '0'
179+
)
180+
port map(
181+
clk => clk_50mhz_fpga2,
182+
reset_async => sp_to_fpga2_system_reset_l,
183+
reset_sync => reset_50m -- this is our synchronized reset now
184+
);
185+
186+
-- Simple blinking LED based on a counter
187+
led_blink: process(clk_50mhz_fpga2, reset_50m)
188+
begin
189+
if reset_50m then
190+
led_blink_cntr <= (others => '0');
191+
elsif rising_edge(clk_50mhz_fpga2) then
192+
led_blink_cntr <= led_blink_cntr + 1;
193+
end if;
194+
end process;
195+
fpga2_status_led <= led_blink_cntr(led_blink_cntr'high);
196+
197+
-- placeholder mcio stuff
198+
fpga2_to_mcio_perst_l <= '0';
199+
fpga2_to_v12_mcio_a0hp_hsc_en <= '0';
200+
201+
-- Our SPI target block
202+
spi_axi_controller_inst: entity work.spi_axi_controller
203+
port map(
204+
clk => clk_50mhz_fpga2,
205+
reset => reset_50m,
206+
csn => spi_sp_mux_to_fpga2_cs_l,
207+
sclk => spi_sp_mux_to_fpga2_sck,
208+
copi => spi_sp_mux_to_fpga2_dat,
209+
cipo => spi_fpga2_to_sp_mux_dat,
210+
awvalid => open,
211+
awready => '1',
212+
awaddr => open,
213+
wvalid => open,
214+
wready => '1',
215+
wdata => open,
216+
wstrb => open,
217+
bvalid => '1',
218+
bready => open,
219+
bresp => "00",
220+
arvalid => open,
221+
arready => '1',
222+
araddr => open,
223+
rvalid => '1',
224+
rready => open,
225+
rdata => (others => '0'),
226+
rresp => "00"
227+
);
228+
229+
-- Need AXI "fabric" block
230+
231+
-- Need Info block
232+
233+
-- Need qty 2 I/O expanders
234+
235+
-- Need qty 4 muxes
236+
237+
176238
end rtl;

0 commit comments

Comments
 (0)