-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SPI Engine: SDO data prefetch #1501
base: main
Are you sure you want to change the base?
Changes from all commits
d845ac3
c504d82
a87a4c6
61558f3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change | ||||
---|---|---|---|---|---|---|
@@ -1,6 +1,6 @@ | ||||||
// *************************************************************************** | ||||||
// *************************************************************************** | ||||||
// Copyright (C) 2015-2024 Analog Devices, Inc. All rights reserved. | ||||||
// Copyright (C) 2015-2025 Analog Devices, Inc. All rights reserved. | ||||||
// | ||||||
// In this HDL repository, there are many different and unique modules, consisting | ||||||
// of various HDL (Verilog or VHDL) components. The individual modules are | ||||||
|
@@ -95,7 +95,7 @@ module spi_engine_offload #( | |||||
localparam SDO_SOURCE_MEM = 1'b0; | ||||||
|
||||||
reg spi_active = 1'b0; | ||||||
reg sdo_source_select = SDO_SOURCE_MEM; | ||||||
wire sdo_source_select; | ||||||
|
||||||
reg [CMD_MEM_ADDRESS_WIDTH-1:0] ctrl_cmd_wr_addr = 'h00; | ||||||
reg [CMD_MEM_ADDRESS_WIDTH-1:0] spi_cmd_rd_addr = 'h00; | ||||||
|
@@ -111,10 +111,12 @@ module spi_engine_offload #( | |||||
wire [CMD_MEM_ADDRESS_WIDTH-1:0] spi_cmd_rd_addr_next; | ||||||
wire spi_enable; | ||||||
wire trigger_posedge; | ||||||
reg sdo_mem_valid; | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Move to reg section of file? |
||||||
|
||||||
assign sdo_source_select = SDO_STREAMING; | ||||||
assign cmd_valid = spi_active; | ||||||
assign sdo_data_valid = (sdo_source_select == SDO_SOURCE_STREAM) ? | ||||||
s_axis_sdo_valid : spi_active; | ||||||
s_axis_sdo_valid : (spi_active && sdo_mem_valid); | ||||||
assign s_axis_sdo_ready = (sdo_source_select == SDO_SOURCE_STREAM) ? | ||||||
sdo_data_ready : 1'b0; | ||||||
assign offload_sdi_valid = sdi_data_valid; | ||||||
|
@@ -278,34 +280,14 @@ module spi_engine_offload #( | |||||
if (!spi_active) begin | ||||||
// start offload when we have a valid trigger, offload is enabled and | ||||||
// the DMA is enabled | ||||||
if (trigger_posedge && spi_enable && (offload_sdi_ready || (SDO_STREAMING && s_axis_sdo_valid))) | ||||||
if (trigger_posedge && spi_enable) | ||||||
spi_active <= 1'b1; | ||||||
end else if (cmd_ready && (spi_cmd_rd_addr_next == ctrl_cmd_wr_addr)) begin | ||||||
spi_active <= 1'b0; | ||||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
always @(posedge spi_clk ) begin | ||||||
if (!spi_resetn) begin | ||||||
sdo_source_select <= SDO_SOURCE_MEM; | ||||||
end else begin | ||||||
if (SDO_STREAMING) begin | ||||||
if (sdo_source_select == SDO_SOURCE_MEM) begin | ||||||
// switch to streaming sdo after we're done with reading the sdo memory | ||||||
if (sdo_data_valid && sdo_data_ready && (spi_sdo_rd_addr+1 == ctrl_sdo_wr_addr)|| (ctrl_sdo_wr_addr==0 && spi_active) ) begin | ||||||
sdo_source_select <= SDO_SOURCE_STREAM; | ||||||
end | ||||||
end else begin | ||||||
// switch back to sdo memory after last command accepted | ||||||
if (cmd_ready && (spi_cmd_rd_addr_next == ctrl_cmd_wr_addr)) begin | ||||||
sdo_source_select <= SDO_SOURCE_MEM; | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
always @(posedge spi_clk) begin | ||||||
if (!cmd_valid) begin | ||||||
spi_cmd_rd_addr <= 'h00; | ||||||
|
@@ -322,6 +304,18 @@ module spi_engine_offload #( | |||||
end | ||||||
end | ||||||
|
||||||
always @(posedge spi_clk ) begin | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
if (!spi_resetn) begin | ||||||
sdo_mem_valid <= 1'b0; | ||||||
end else begin | ||||||
if (!spi_active && trigger_posedge && spi_enable) begin | ||||||
sdo_mem_valid <= (ctrl_sdo_wr_addr != 'h00); // if ctrl_sdo_wr_addr is 0, mem is empty | ||||||
end else if (sdo_data_ready && spi_active && sdo_mem_valid && (spi_sdo_rd_addr + 1'b1 == ctrl_sdo_wr_addr)) begin | ||||||
sdo_mem_valid <= 1'b0; | ||||||
end | ||||||
end | ||||||
end | ||||||
|
||||||
always @(posedge ctrl_clk) begin | ||||||
if (ctrl_mem_reset) | ||||||
ctrl_cmd_wr_addr <= 'h00; | ||||||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,3 +13,5 @@ ad_ip_parameter rom_sys_0 CONFIG.PATH_TO_FILE "$mem_init_sys_file_path/mem_init_ | |
ad_ip_parameter rom_sys_0 CONFIG.ROM_ADDR_BITS 9 | ||
|
||
sysid_gen_sys_init_file | ||
|
||
set_property strategy Performance_Retiming [get_runs impl_1] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This usually goes in the system_project.tcl not _db (28 _project.tcl vs 2 _bd.tcl) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Move to wires section of file?