Skip to content

Commit 37ebdde

Browse files
Proof of concept periph 0 UART
1 parent ac61b10 commit 37ebdde

File tree

8 files changed

+19
-11
lines changed

8 files changed

+19
-11
lines changed

hdl/ip/vhd/espi/espi_spec_regs.rdl

+1-1
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ addrmap eSPI_Spec {
100100
field {
101101
desc = "OOB Message Channel Supported";
102102
sw = r;
103-
} oob_support[2:2] = 0x1;
103+
} oob_support[2:2] = 0x0;
104104
field {
105105
desc = "Virtual Wire Channel Supported";
106106
sw = r;

hdl/ip/vhd/espi/espi_target_top.vhd

-1
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ begin
220220
clk => clk,
221221
reset => reset,
222222
axi_if => axi_if,
223-
msg_en => msg_en,
224223
dbg_chan => dbg_chan
225224
);
226225

hdl/ip/vhd/espi/link_layer/link_layer_pkg.vhd

+3
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,9 @@ package body link_layer_pkg is
147147
when message_with_data =>
148148
-- opcode, standard header (3), 5 mesg header bytes, length bytes, crc
149149
return To_StdLogicVector(1 + 3 + 5 + to_integer(h.len) + 1, 13);
150+
when mem_write_32 =>
151+
-- opcode, standard header (3), 4 addr bytes, length bytes, crc
152+
return To_StdLogicVector(1 + 3 + 4 + to_integer(h.len) + 1, 13);
150153
when others =>
151154
assert false report "Unsupported cycle type" severity failure;
152155
return To_StdLogicVector(0, 13);

hdl/ip/vhd/espi/peripheral_channel/uart_channel_top.vhd

+5-3
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,9 @@ begin
8282
np_free <= '0';
8383
np_avail <= '0';
8484
pc_free <= '1' when (fifo_depth - rx_wusedwds) >= max_msg_size else '0';
85-
pc_avail <= (not tx_rempty) and pc_avail_not_masked and msg_not_oob_syncd;
86-
oob_free <= '1' when (fifo_depth - rx_wusedwds) >= max_msg_size else '0';
87-
oob_avail <= (not tx_rempty) and pc_avail_not_masked and (not msg_not_oob_syncd);
85+
pc_avail <= '0'; --(not tx_rempty) and pc_avail_not_masked and msg_not_oob_syncd;
86+
oob_free <= '0'; --'1' when (fifo_depth - rx_wusedwds) >= max_msg_size else '0';
87+
oob_avail <= '0'; --(not tx_rempty) and pc_avail_not_masked and (not msg_not_oob_syncd);
8888

8989
host_to_sp_espi.ready <= not rx_wfull;
9090
-- tx_rusedwds is potentailly cycles behind the empty flag due to fifo latencies.
@@ -95,6 +95,8 @@ begin
9595

9696
fifo_read_by_espi <= sp_to_host_espi.st.valid and sp_to_host_espi.st.ready;
9797

98+
-- Need a bit of a re-write here.
99+
98100
-- We want to hold some data to let the bytes accumulate
99101
-- so that we're not doing multiple transactions (which are multi-byte)
100102
-- but just transferring 1-2 bytes at a time.

hdl/ip/vhd/espi/sys_regs/espi_regs.rdl

-3
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,6 @@ addrmap espi_regs {
2323
reg {
2424
name = "Control Register";
2525
desc = "";
26-
field {
27-
desc = "Respond back on periph 0 channel vs oob";
28-
} msg_en[4:4] = 0;
2926
field {
3027
desc = "Set to one to reset the command FIFO. Cleared by hardware after reset.";
3128
} cmd_fifo_reset[3:3] = 0;

hdl/ip/vhd/espi/sys_regs/espi_regs.vhd

-2
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@ entity espi_regs is
2020
reset : in std_logic;
2121
-- axi interface
2222
axi_if : view axil_target;
23-
msg_en : out std_logic;
2423
-- debug interface
2524
dbg_chan : view dbg_regs_if
2625

@@ -49,7 +48,6 @@ begin
4948
fifo_status_reg.resp_used_wds <= dbg_chan.rdstatus.usedwds;
5049
status_reg.busy <= dbg_chan.busy;
5150
flags_reg.alert <= dbg_chan.alert_pending;
52-
msg_en <= control_reg.msg_en;
5351

5452
-- unpack the record
5553
axi_if.write_response.resp <= OKAY;

hdl/ip/vhd/espi/txn_layer/command_processor.vhd

+8-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,12 @@ architecture rtl of command_processor is
138138
next_state.next_state := parse_msg_header;
139139
next_state.cmd_addr_bytes := 0;
140140
next_state.cmd_payload_bytes := to_integer(header.length);
141+
when mem_write_32 =>
142+
-- mem writes have a payload of "length"
143+
next_state.next_state := parse_addr_header;
144+
next_state.cmd_payload_bytes := to_integer(header.length);
141145
when others =>
146+
-- use the default value for next_state
142147
null;
143148
end case;
144149
when opcode_put_oob =>
@@ -163,7 +168,9 @@ begin
163168
vwire_if.wstrobe <= r.vwire_wstrobe;
164169

165170
host_to_sp_espi.data <= data_from_host.data;
166-
host_to_sp_espi.valid <= data_from_host.valid when r.cmd_header.opcode.value = opcode_put_pc and r.cmd_header.cycle_kind = message_with_data and r.state = parse_data else
171+
host_to_sp_espi.valid <= data_from_host.valid when r.cmd_header.opcode.value = opcode_put_pc and
172+
(r.cmd_header.cycle_kind = message_with_data or
173+
r.cmd_header.cycle_kind = mem_write_32) and r.state = parse_data else
167174
data_from_host.valid when r.cmd_header.opcode.value = opcode_put_oob and r.state = parse_data else '0';
168175
-- pass through the flash channel requests here
169176
flash_req.espi_hdr <= r.cmd_header;

hdl/ip/vhd/espi/txn_layer/espi_protocol_pkg.vhd

+2
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ package espi_protocol_pkg is
4242
-- eSPI Channel
4343
constant mem_read_32 : std_logic_vector(7 downto 0) := "00000000";
4444
constant mem_read_64 : std_logic_vector(7 downto 0) := "00000010";
45+
constant mem_write_32 : std_logic_vector(7 downto 0) := "00000001";
46+
constant mem_write_64 : std_logic_vector(7 downto 0) := "00000011";
4547
-- Flash channel (from server addendum)
4648
constant flash_read : std_logic_vector(7 downto 0) := "00000000";
4749
constant success_no_data : std_logic_vector(7 downto 0) := "00000110";

0 commit comments

Comments
 (0)