Skip to content

Commit fb178fe

Browse files
More cosmo work (#314)
There's some missing TB stuff still that I'm working on but I want to get a "real" release into hubris so matt can start working on real sequencer logic. This continues burning down the open issues in #305.
1 parent a1384ff commit fb178fe

18 files changed

+402
-53
lines changed

hdl/projects/cosmo_seq/BUCK

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ rdl_file(
77
src = "cosmo_seq_top.rdl",
88
deps = [
99
"//hdl/ip/vhd/info:info_regs_rdl",
10+
"//hdl/projects/cosmo_seq/sp_i2c_subsystem:sp_i2c_regs_rdl",
1011
"//hdl/projects/cosmo_seq/sequencer:sequencer_regs_rdl",
1112
"//hdl/ip/vhd/spi_nor_controller:spi_nor_regs_rdl",
1213
"//hdl/ip/vhd/espi:espi_regs_rdl",

hdl/projects/cosmo_seq/cosmo_seq_top.rdl

+4-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,8 @@ addrmap cosmo_seq_top {
22
default regwidth = 32;
33
// Instantiate 2 to test nesting
44
info_regs info @ 0x0;
5-
sequencer_regs sequencer @ 0x100;
6-
spi_nor_regs spi_nor @ 0x0200;
7-
espi_regs espi @ 0x0300;
5+
spi_nor_regs spi_nor @ 0x0100;
6+
espi_regs espi @ 0x0200;
7+
sequencer_regs sequencer @ 0x300;
8+
sp_i2c_regs sp_i2c @ 0x0400;
89
};

hdl/projects/cosmo_seq/cosmo_seq_top.vhd

+24-16
Original file line numberDiff line numberDiff line change
@@ -296,17 +296,17 @@ architecture rtl of cosmo_seq_top is
296296
signal reset_fmc : std_logic;
297297
alias fmc_clk : std_logic is fmc_sp_to_fpga1_clk;
298298
constant INFO_RESP_IDX : integer := 0;
299-
constant BRD_RESP_IDX: integer := 1;
300-
constant SPINOR_RESP_IDX: integer := 2;
301-
constant ESPI_RESP_IDX: integer := 3;
302-
constant SEQ_RESP_IDX: integer := 4;
299+
constant SPINOR_RESP_IDX: integer := 1;
300+
constant ESPI_RESP_IDX: integer := 2;
301+
constant SEQ_RESP_IDX: integer := 3;
302+
constant SP_I2C_RESP_IDX: integer := 4;
303303

304304
constant config_array : axil_responder_cfg_array_t :=
305305
(INFO_RESP_IDX => (base_addr => x"00000000", addr_span_bits => 8),
306-
BRD_RESP_IDX => (base_addr => x"00000100", addr_span_bits => 8),
307-
SPINOR_RESP_IDX => (base_addr => x"00000200", addr_span_bits => 8),
308-
ESPI_RESP_IDX => (base_addr => x"00000300", addr_span_bits => 8),
309-
SEQ_RESP_IDX => (base_addr => x"00000400", addr_span_bits => 8)
306+
SPINOR_RESP_IDX => (base_addr => x"00000100", addr_span_bits => 8),
307+
ESPI_RESP_IDX => (base_addr => x"00000200", addr_span_bits => 8),
308+
SEQ_RESP_IDX => (base_addr => x"00000300", addr_span_bits => 8),
309+
SP_I2C_RESP_IDX => (base_addr => x"00000400", addr_span_bits => 8)
310310
);
311311
signal fmc_axi_if : axil26x32_pkg.axil_t;
312312
signal responders : axil8x32_pkg.axil_array_t(config_array'range);
@@ -339,6 +339,9 @@ architecture rtl of cosmo_seq_top is
339339
signal sp5_sda_o : std_logic;
340340
signal sp5_sda_oe : std_logic;
341341

342+
signal sp5_t6_power_en : std_logic;
343+
signal sp5_t6_perst_l : std_logic;
344+
342345
begin
343346

344347
fpga1_spare_v3p3(7 downto 1) <= (others => 'Z');
@@ -353,11 +356,6 @@ begin
353356
fpga1_uart1_buff_oe_en_l <= '0' when a0_ok else '1'; -- not used but why not enable anyway?
354357
uart1_fpga1_to_sp5_dat_buff <= '1'; -- Make this idle generally, buffer protects from cross-drive
355358

356-
-- TODO: need to sort out what to do about backplane/sidecar
357-
fpga1_to_bp_buff_output_en_l <= 'Z';
358-
pcie_aux_fpga1_to_rsw_perst_l <= '0';
359-
fpga1_to_pcie_clk_buff_rsw_oe_l <= 'Z';
360-
361359

362360
---------------------------------------------
363361
-- FMC to AXI Inteface from the SP
@@ -486,13 +484,13 @@ begin
486484
port map(
487485
clk => clk_125m,
488486
reset => reset_125m,
487+
axi_if => responders(SP_I2C_RESP_IDX),
489488
sp_scl => i2c_sp_to_fpga1_scl,
490489
sp_scl_o => sp_scl_o,
491490
sp_scl_oe => sp_scl_oe,
492491
sp_sda => i2c_sp_to_fpga1_sda,
493492
sp_sda_o => sp_sda_o,
494493
sp_sda_oe => sp_sda_oe,
495-
mux_reset => '0',
496494
i2c_mux1_sel => fpga1_to_i2c_mux1_sel,
497495
i2c_mux2_sel => fpga1_to_i2c_mux2_sel,
498496
i2c_mux3_sel => fpga1_to_i2c_mux3_sel
@@ -523,8 +521,16 @@ begin
523521
m2b_prsnt_l => m2b_to_fpga1_prsnt_l,
524522
m2b_hsc_en => fpga1_to_m2b_hsc_en,
525523
m2b_perst_l => fpga1_to_m2b_perst_l,
526-
pcie_clk_buff_m2b_oe_l => fpga1_to_pcie_clk_buff_m2b_oe_l
524+
pcie_clk_buff_m2b_oe_l => fpga1_to_pcie_clk_buff_m2b_oe_l,
525+
t6_power_en => sp5_t6_power_en,
526+
t6_perst_l => sp5_t6_perst_l,
527+
pcie_aux_rsw_perst_l => pcie_aux_fpga1_to_rsw_perst_l,
528+
pcie_aux_rsw_prsnt_buff_l => pcie_aux_rsw_to_fpga1_prsnt_buff_l,
529+
pcie_aux_rsw_pwrflt_buff_l=> pcie_aux_rsw_to_fpga1_pwrflt_buff_l,
530+
pcie_clk_buff_rsw_oe_l => fpga1_to_pcie_clk_buff_rsw_oe_l,
531+
rsw_sp5_pcie_attached_buff_l =>rsw_to_sp5_pcie_attached_buff_l
527532
);
533+
528534
--Tristates for spi-nor flash pins and espi
529535
i2c_sp5_to_fpgax_hp_scl <= sp5_scl_o when sp5_scl_oe = '1' else 'Z';
530536
i2c_sp5_to_fpgax_hp_sda <= sp5_sda_o when sp5_sda_oe = '1' else 'Z';
@@ -548,7 +554,9 @@ begin
548554
group_c_pins => sp5_group_c,
549555
sp5_seq_pins => sp5_seq_pins,
550556
nic_rails_pins => nic_rails,
551-
nic_seq_pins => nic_seq_pins
557+
nic_seq_pins => nic_seq_pins,
558+
sp5_t6_power_en => sp5_t6_power_en,
559+
sp5_t6_perst_l => sp5_t6_perst_l
552560
);
553561

554562
-- early power related pins

hdl/projects/cosmo_seq/sequencer/BUCK

+7-7
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ vhdl_unit(
2222
standard = "2019",
2323
)
2424

25-
# vunit_sim(
26-
# name = "sp5_sequencer_sim",
27-
# srcs = glob(["sims/**/*.vhd"]),
28-
# deps = [
29-
# ],
30-
# visibility = ['PUBLIC'],
31-
# )
25+
vunit_sim(
26+
name = "sp5_seq_sim",
27+
srcs = glob(["sims/**/*.vhd"]),
28+
deps = [
29+
],
30+
visibility = ['PUBLIC'],
31+
)

hdl/projects/cosmo_seq/sequencer/a1_a0_seq.vhd

+6-1
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,7 @@ architecture rtl of a1_a0_seq is
9595
group_c_expected: std_logic;
9696
ddr_bulk_expected: std_logic;
9797
faulted: std_logic;
98+
is_cosmo : std_logic;
9899
end record;
99100

100101
constant seq_r_t_reset : seq_r_t := (
@@ -113,6 +114,7 @@ architecture rtl of a1_a0_seq is
113114
'0',
114115
'0',
115116
'0',
117+
'0',
116118
'0'
117119
);
118120
signal seq_r, seq_rin : seq_r_t;
@@ -204,7 +206,8 @@ begin
204206

205207
case seq_r.state is
206208
when IDLE =>
207-
v.pwr_btn_l := '1';
209+
v.is_cosmo := '0'; -- assert after power-up
210+
v.pwr_btn_l := '0'; -- assert after power up, don't cross-drive
208211
v.ddr_bulk_en := '0';
209212
v.group_a_en := '0';
210213
v.group_b_en := '0';
@@ -248,6 +251,7 @@ begin
248251
-- these are expected to remain up.
249252
v.group_a_expected := '1';
250253
v.ddr_bulk_expected := '1';
254+
v.pwr_btn_l := '1';
251255
end if;
252256
-- Release RSM_RST_L
253257
when RSM_RST_DEASSERT =>
@@ -320,6 +324,7 @@ begin
320324
end if;
321325
-- Drive PWRGOOD to the SP5
322326
when ASSERT_PWRGOOD =>
327+
v.is_cosmo := '1'; -- assert GPIO to SP5 for cosmo detection
323328
v.pwr_good := '1';
324329
v.state := WAIT_PWROK;
325330
-- We expect SP5 to respond back with PWR_OK

hdl/projects/cosmo_seq/sequencer/nic_seq.vhd

+5-1
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ entity nic_seq is
2525
debug_enables : in debug_enables_type;
2626
nic_overrides_reg : in nic_overrides_type;
2727

28+
-- From SP5 hotplug
29+
sp5_t6_power_en : in std_logic;
30+
sp5_t6_perst_l : in std_logic;
31+
2832
nic_rails: view nic_power_at_fpga;
2933
nic_seq_pins: view nic_seq_at_fpga;
3034

@@ -153,7 +157,7 @@ begin
153157
-- write protect out of MFG modes
154158
final_nic_outs.eeprom_wp_l <= not mfg_mode_l;
155159
final_nic_outs.nic_mfg_mode_l <= mfg_mode_l;
156-
final_nic_outs.perst_l <= nic_r.nic_perst_l;
160+
final_nic_outs.perst_l <= nic_r.nic_perst_l and sp5_t6_perst_l;
157161
final_nic_outs.cld_rst_l <= nic_r.nic_cld_rst_l;
158162
end if;
159163

hdl/projects/cosmo_seq/sequencer/sequencer_io_pkg.vhd

+2
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ package sequencer_io_pkg is
4444
rsmrst_l : std_logic;
4545
pwr_btn_l : std_logic;
4646
pwr_good : std_logic;
47+
is_cosmo : std_logic; -- uses SP5_TO_FPGA1_DEBUG1 high at power up to indicate cosmo
4748
end record;
4849
-- FPGA's view of the world as the controller and recipient of
4950
-- the feedback
@@ -56,6 +57,7 @@ package sequencer_io_pkg is
5657
rsmrst_l : out;
5758
pwr_btn_l : out;
5859
pwr_good : out;
60+
is_cosmo : out;
5961
end view;
6062
alias sp5_seq_at_sp5 is sp5_seq_at_fpga'converse;
6163

hdl/projects/cosmo_seq/sequencer/sims/nic_model.vhd

+10-12
Original file line numberDiff line numberDiff line change
@@ -28,17 +28,15 @@ begin
2828
-- for now, though we implement the most basic of models where the rails
2929
-- turn on when requested after some delay
3030

31-
-- The block we're interfacing with expects to be synchronized
32-
process(clk)
33-
begin
34-
nic_rails.v1p5_nic_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
35-
nic_rails.v1p2_nic_pcie_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
36-
nic_rails.v1p2_nic_enet_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
37-
nic_rails.v3p3_nic_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
38-
nic_rails.v1p1_nic_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
39-
nic_rails.v0p96_nic_vdd_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
40-
nic_rails.nic_hsc_12v.pg <= nic_rails.nic_hsc_12v.enable;
41-
nic_rails.nic_hsc_5v.pg <= nic_rails.nic_hsc_12v.enable;
42-
end process;
31+
32+
33+
nic_rails.v1p5_nic_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
34+
nic_rails.v1p2_nic_pcie_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
35+
nic_rails.v1p2_nic_enet_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
36+
nic_rails.v3p3_nic_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
37+
nic_rails.v1p1_nic_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
38+
nic_rails.v0p96_nic_vdd_a0hp.pg <= nic_rails.nic_hsc_12v.enable;
39+
nic_rails.nic_hsc_12v.pg <= nic_rails.nic_hsc_12v.enable;
40+
nic_rails.nic_hsc_5v.pg <= nic_rails.nic_hsc_12v.enable;
4341

4442
end model;

hdl/projects/cosmo_seq/sequencer/sims/rail_model.vhd

+1-5
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,5 @@ begin
2929
-- for now, though we implement the most basic of models where the rails
3030
-- turn on when requested after some delay
3131

32-
-- The block we're interfacing with expects to be synchronized
33-
process(clk)
34-
begin
35-
rail.pg <= rail.enable;
36-
end process;
32+
rail.pg <= rail.enable;
3733
end model;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
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 2024 Oxide Computer Company
6+
7+
library ieee;
8+
use ieee.std_logic_1164.all;
9+
use ieee.numeric_std.all;
10+
use ieee.numeric_std_unsigned.all;
11+
12+
library vunit_lib;
13+
context vunit_lib.com_context;
14+
context vunit_lib.vunit_context;
15+
context vunit_lib.vc_context;
16+
17+
18+
entity sp5_seq_sim_tb is
19+
generic (
20+
21+
runner_cfg : string
22+
);
23+
end entity;
24+
25+
architecture tb of sp5_seq_sim_tb is
26+
27+
begin
28+
29+
th: entity work.sp5_seq_sim_th;
30+
31+
bench: process
32+
alias reset is << signal th.reset : std_logic >>;
33+
begin
34+
-- Always the first thing in the process, set up things for the VUnit test runner
35+
test_runner_setup(runner, runner_cfg);
36+
-- Reach into the test harness, which generates and de-asserts reset and hold the
37+
-- test cases off until we're out of reset. This runs for every test case
38+
wait until reset = '0';
39+
wait for 500 ns; -- let the resets propagate
40+
41+
while test_suite loop
42+
if run("") then
43+
null;
44+
end if;
45+
end loop;
46+
47+
wait for 2 us;
48+
test_runner_cleanup(runner);
49+
wait;
50+
end process;
51+
52+
-- Example total test timeout dog
53+
test_runner_watchdog(runner, 10 ms);
54+
55+
end tb;
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
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 2024 Oxide Computer Company
6+
7+
library ieee;
8+
use ieee.std_logic_1164.all;
9+
use ieee.numeric_std.all;
10+
11+
library vunit_lib;
12+
context vunit_lib.vunit_context;
13+
context vunit_lib.com_context;
14+
context vunit_lib.vc_context;
15+
16+
use work.axil8x32_pkg;
17+
use work.sequencer_io_pkg.all;
18+
19+
entity sp5_seq_sim_th is
20+
end entity;
21+
22+
architecture th of sp5_seq_sim_th is
23+
24+
signal clk : std_logic := '0';
25+
signal reset : std_logic := '1';
26+
27+
begin
28+
29+
-- set up a fastish clock for the sim env
30+
-- and release reset after a bit of time
31+
clk <= not clk after 4 ns;
32+
reset <= '0' after 200 ns;
33+
34+
-- instantiate the sequencer
35+
-- dut: entity work.sp5_sequencer
36+
-- generic map(
37+
-- CNTS_P_MS => CNTS_P_MS
38+
-- )
39+
-- port map(
40+
-- clk => clk,
41+
-- reset => reset,
42+
-- axi_if => axi_if,
43+
-- a0_ok => a0_ok,
44+
-- a0_idle => a0_idle,
45+
-- early_power_pins => early_power_pins,
46+
-- ddr_bulk_pins => ddr_bulk_pins,
47+
-- group_a_pins => group_a_pins,
48+
-- group_b_pins => group_b_pins,
49+
-- group_c_pins => group_c_pins,
50+
-- sp5_seq_pins => sp5_seq_pins,
51+
-- nic_rails_pins => nic_rails_pins,
52+
-- nic_seq_pins => nic_seq_pins,
53+
-- sp5_t6_power_en => sp5_t6_power_en,
54+
-- sp5_t6_perst_l => sp5_t6_perst_l
55+
-- );
56+
57+
-- sp5_model_inst: entity work.sp5_model
58+
-- port map(
59+
-- clk => clk,
60+
-- reset => reset,
61+
-- sp5_pins => sp5_pins
62+
-- );
63+
64+
-- nic_model_inst: entity work.nic_model
65+
-- port map(
66+
-- clk => clk,
67+
-- reset => reset,
68+
-- nic_rails => nic_rails
69+
-- );
70+
71+
end th;

0 commit comments

Comments
 (0)