Skip to content

Commit

Permalink
Merge branch 'dev' into blitzcoin-dev
Browse files Browse the repository at this point in the history
Conflicts:
	rtl/noc/sync_noc32_xy.vhd
	rtl/noc/sync_noc_set.vhd
	rtl/noc/sync_noc_xy.vhd
	rtl/sockets/proxy/esp_acc_dma.vhd
	tools/socgen/NoCConfiguration.py
	utils/flist/vhdl_pkgs.flist
  • Loading branch information
jzuckerman committed Jun 17, 2024
2 parents 862ea45 + ba12d4e commit 9e3a228
Show file tree
Hide file tree
Showing 84 changed files with 4,933 additions and 761 deletions.
101 changes: 100 additions & 1 deletion rtl/noc/nocpackage.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,12 @@ package nocpackage is
-- |reserved|
--

-- Header with 2 destinations
-- |W+1 W|W-1 W-3|W-4 W-6|W-7 W-9|W-10 W-12|W-13 W-15|W-16 W-18|W-19 W-20|W-21 W-25|W-26 5|4 0|
-- | PREAMBLE | Src Y | Src X | Dst1 Y | Dst1 X | Dst1 Y | Dst1 X | Valid | Msg. type | Reserved |LEWSN|



constant HEADER_ROUTE_L : natural := 4;
constant HEADER_ROUTE_E : natural := 3;
constant HEADER_ROUTE_W : natural := 2;
Expand Down Expand Up @@ -67,14 +73,15 @@ package nocpackage is
type misc_noc_flit_vector is array (natural range <>) of misc_noc_flit_type;
type arch_noc_flit_vector is array (natural range <>) of arch_noc_flit_type;


--Rather than define seaprate functions for interacting with each NoC width,
--we make them take the max width and then pad the inputs to fill.
constant coh_noc_flit_pad : std_logic_vector(MAX_NOC_FLIT_SIZE - COH_NOC_FLIT_SIZE downto 0) := (others => '0');
constant dma_noc_flit_pad : std_logic_vector(MAX_NOC_FLIT_SIZE - DMA_NOC_FLIT_SIZE downto 0) := (others => '0');
constant misc_noc_flit_pad : std_logic_vector(MAX_NOC_FLIT_SIZE - MISC_NOC_FLIT_SIZE downto 0) := (others => '0');
constant arch_noc_flit_pad : std_logic_vector(MAX_NOC_FLIT_SIZE - ARCH_NOC_FLIT_SIZE downto 0) := (others => '0');

type dest_arr is array (natural range <>) of local_yx;

-- Preamble encoding
constant PREAMBLE_HEADER : noc_preamble_type := "10";
constant PREAMBLE_TAIL : noc_preamble_type := "01";
Expand Down Expand Up @@ -187,6 +194,7 @@ package nocpackage is
constant ROUTER_DEPTH : integer := 4;

type yx_vec is array (natural range <>) of std_logic_vector(2 downto 0);
type routing_vec is array (natural range <>) of std_logic_vector(NEXT_ROUTING_WIDTH - 1 downto 0);

type tile_mem_info is record
x : local_yx;
Expand Down Expand Up @@ -499,6 +507,18 @@ package nocpackage is
reserved : reserved_field_type)
return std_logic_vector;

function create_header_mcast (
constant flit_sz : integer;
local_y : local_yx;
local_x : local_yx;
remote_y_arr : yx_vec(MAX_MCAST_DESTS - 2 downto 0);
remote_x_arr : yx_vec(MAX_MCAST_DESTS - 2 downto 0);
remote_y_comb : local_yx;
remote_x_comb : local_yx;
mcast_ndests : integer;
msg_type : noc_msg_type)
return std_logic_vector;

function narrow_to_large_flit (
narrow_flit : misc_noc_flit_type)
return arch_noc_flit_type;
Expand Down Expand Up @@ -822,6 +842,85 @@ package body nocpackage is
return header;
end create_header;

function create_header_mcast (
constant flit_sz : integer;
local_y : local_yx;
local_x : local_yx;
remote_y_arr : yx_vec(MAX_MCAST_DESTS - 2 downto 0);
remote_x_arr : yx_vec(MAX_MCAST_DESTS - 2 downto 0);
remote_y_comb : local_yx;
remote_x_comb : local_yx;
mcast_ndests : integer;
msg_type : noc_msg_type)
return std_logic_vector is
variable header : std_logic_vector(flit_sz - 1 downto 0);
variable go_right, go_left, go_up, go_down, routing: std_logic_vector(NEXT_ROUTING_WIDTH - 1 downto 0);
variable remote_y, remote_x : yx_vec(MAX_MCAST_DESTS - 1 downto 0);
constant RESERVED_OFFSET_MCAST : integer := flit_sz - PREAMBLE_WIDTH - NEXT_ROUTING_WIDTH - MSG_TYPE_WIDTH
- (1 + MAX_MCAST_DESTS) * 2 * YX_WIDTH - MAX_MCAST_DESTS;
begin -- create_header_ndest

header := (others => '0');

remote_y := (others => (others => '0'));
remote_x := (others => (others => '0'));
remote_y(MAX_MCAST_DESTS - 2 downto 0) := remote_y_arr;
remote_x(MAX_MCAST_DESTS - 2 downto 0) := remote_x_arr;
remote_y(mcast_ndests) := remote_y_comb;
remote_x(mcast_ndests) := remote_x_comb;

header(flit_sz - 1 downto
flit_sz - PREAMBLE_WIDTH) := PREAMBLE_HEADER;
header(flit_sz - PREAMBLE_WIDTH - 1 downto
flit_sz - PREAMBLE_WIDTH - YX_WIDTH) := local_y;
header(flit_sz - PREAMBLE_WIDTH - YX_WIDTH - 1 downto
flit_sz - PREAMBLE_WIDTH - 2*YX_WIDTH) := local_x;
header(flit_sz - PREAMBLE_WIDTH - 2*YX_WIDTH - 1 downto
flit_sz - PREAMBLE_WIDTH - 3*YX_WIDTH) := remote_y(0);
header(flit_sz - PREAMBLE_WIDTH - 3*YX_WIDTH - 1 downto
flit_sz - PREAMBLE_WIDTH - 4*YX_WIDTH) := remote_x(0);
header(flit_sz - PREAMBLE_WIDTH - 4*YX_WIDTH - 1 downto
flit_sz - PREAMBLE_WIDTH - 4*YX_WIDTH - MSG_TYPE_WIDTH) := msg_type;
for i in 1 to MAX_MCAST_DESTS - 1 loop
header(flit_sz - PREAMBLE_WIDTH - (4+2*(i-1))*YX_WIDTH - MSG_TYPE_WIDTH - RESERVED_OFFSET_MCAST - 1 downto
flit_sz - PREAMBLE_WIDTH - (5+2*(i-1))*YX_WIDTH - MSG_TYPE_WIDTH - RESERVED_OFFSET_MCAST) := remote_y(i);
header(flit_sz - PREAMBLE_WIDTH - (5+2*(i-1))*YX_WIDTH - MSG_TYPE_WIDTH - RESERVED_OFFSET_MCAST - 1 downto
flit_sz - PREAMBLE_WIDTH - (6+2*(i-1))*YX_WIDTH - MSG_TYPE_WIDTH - RESERVED_OFFSET_MCAST) := remote_x(i);
end loop;


for i in 0 to MAX_MCAST_DESTS - 1 loop
header(flit_sz - PREAMBLE_WIDTH - (1 + MAX_MCAST_DESTS) * 2 * YX_WIDTH - MSG_TYPE_WIDTH
- MAX_MCAST_DESTS - RESERVED_OFFSET_MCAST + i) := '1';
if i <= mcast_ndests then
if local_x < remote_x(i) then
go_right := "01000";
else
go_right := "10111";
end if;

if local_x > remote_x(i) then
go_left := "00100";
else
go_left := "11011";
end if;

if local_y < remote_y(i) then
routing := "01110" and go_left and go_right;
else
routing := "01101" and go_left and go_right;
end if;

if local_y = remote_y(i) and local_x = remote_x(i) then
routing := "10000";
end if;
end if;
header(NEXT_ROUTING_WIDTH-1 downto 0) := header(NEXT_ROUTING_WIDTH-1 downto 0) or routing;
end loop;

return header;
end create_header_mcast;

function narrow_to_large_flit (
narrow_flit : misc_noc_flit_type)
return arch_noc_flit_type is
Expand Down
9 changes: 6 additions & 3 deletions rtl/noc/router.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@ entity router is
flow_control : integer := 0; --0 = AN; 1 = CB
width : integer := 34;
depth : integer := 4;
ports : std_logic_vector(4 downto 0) := "11111"
ports : std_logic_vector(4 downto 0) := "11111";
DEST_SIZE : integer
);
port(
clk : in std_logic;
Expand Down Expand Up @@ -74,7 +75,8 @@ architecture behavior of router is
generic(
FlowControl : std_logic;
Width : integer;
Ports : std_logic_vector(4 downto 0)
Ports : std_logic_vector(4 downto 0);
DEST_SIZE : integer
);
port(
clk : in std_logic;
Expand Down Expand Up @@ -108,7 +110,8 @@ begin
generic map (
FlowControl => to_std_logic(flow_control),
Width => width,
Ports => Ports)
Ports => Ports,
DEST_SIZE => DEST_SIZE)
port map (
clk => clk,
rst => rst,
Expand Down
14 changes: 10 additions & 4 deletions rtl/noc/router/lookahead_router.sv
Original file line number Diff line number Diff line change
Expand Up @@ -83,12 +83,18 @@ module lookahead_router
localparam bit FifoBypassEnable = FlowControl == noc::kFlowControlAckNack;

localparam int unsigned ReservedWidth =
DataWidth - $bits(noc::packet_info_t) - $bits(noc::direction_t);
DataWidth - 2*$bits(noc::xy_t) - $bits(noc::message_t) - $bits(noc::direction_t);

typedef struct packed {
noc::preamble_t preamble;
noc::packet_info_t info;
noc::xy_t source;
noc::xy_t destination;
noc::message_t message;
logic [ReservedWidth-1:0] reserved;
} packet_info_t;

typedef struct packed {
noc::preamble_t preamble;
packet_info_t info;
noc::direction_t routing;
} header_t;

Expand Down Expand Up @@ -481,7 +487,7 @@ module lookahead_router
// pragma coverage off
//VCS coverage off

if (DataWidth < $bits(noc::packet_info_t) + $bits(noc::direction_t)) begin : gen_a_data_width
if (DataWidth < $bits(packet_info_t) + $bits(noc::direction_t)) begin : gen_a_data_width
$fatal(2'd2, "Fail: DataWidth insufficient to hold packet and routing information.");
end

Expand Down
Loading

0 comments on commit 9e3a228

Please sign in to comment.