@@ -76,6 +76,8 @@ input wire savestate_load_err,
7676
7777input wire target_dataslot_read, // rising edge triggered
7878input wire target_dataslot_write,
79+ input wire target_dataslot_getfile,
80+ input wire target_dataslot_openfile,
7981
8082output reg target_dataslot_ack, // asserted upon command start until completion
8183output reg target_dataslot_done, // asserted upon command finish until next command is issued
@@ -86,6 +88,10 @@ input wire [31:0] target_dataslot_slotoffset,
8688input wire [31 :0 ] target_dataslot_bridgeaddr,
8789input wire [31 :0 ] target_dataslot_length,
8890
91+ input wire [31 :0 ] target_buffer_param_struct, // bus address of the memory region APF will fetch additional parameter struct from
92+ input wire [31 :0 ] target_buffer_resp_struct, // bus address of the memory region APF will write its response struct to
93+ // this should be mapped by the developer, the buffer is not implemented in this file
94+
8995input wire [9 :0 ] datatable_addr,
9096input wire datatable_wren,
9197input wire [31 :0 ] datatable_data,
@@ -153,8 +159,8 @@ localparam [3:0] ST_DONE_ERR = 'd15;
153159// target
154160
155161 reg [31 :0 ] target_0;
156- reg [31 :0 ] target_4 = 'h20;
157- reg [31 :0 ] target_8 = 'h40;
162+ reg [31 :0 ] target_4 = 'h20; // target cmd parameter data at 0x20
163+ reg [31 :0 ] target_8 = 'h40; // target cmd response data at 0x40
158164
159165 reg [31 :0 ] target_20; // parameter data
160166 reg [31 :0 ] target_24;
@@ -176,6 +182,8 @@ localparam [3:0] TARG_ST_WAITRESULT_DSO = 'd15;
176182 reg status_setup_done_1, status_setup_done_queue;
177183 reg target_dataslot_read_1, target_dataslot_read_queue;
178184 reg target_dataslot_write_1, target_dataslot_write_queue;
185+ reg target_dataslot_getfile_1, target_dataslot_getfile_queue;
186+ reg target_dataslot_openfile_1, target_dataslot_openfile_queue;
179187
180188
181189initial begin
@@ -192,6 +200,8 @@ initial begin
192200 status_setup_done_queue <= 0 ;
193201 target_dataslot_read_queue <= 0 ;
194202 target_dataslot_write_queue <= 0 ;
203+ target_dataslot_getfile_queue <= 0 ;
204+ target_dataslot_openfile_queue <= 0 ;
195205 target_dataslot_ack <= 0 ;
196206 target_dataslot_done <= 0 ;
197207 target_dataslot_err <= 0 ;
@@ -204,6 +214,8 @@ always @(posedge clk) begin
204214 status_setup_done_1 <= status_setup_done;
205215 target_dataslot_read_1 <= target_dataslot_read;
206216 target_dataslot_write_1 <= target_dataslot_write;
217+ target_dataslot_getfile_1 <= target_dataslot_getfile;
218+ target_dataslot_openfile_1 <= target_dataslot_openfile;
207219
208220 if (status_setup_done & ~ status_setup_done_1) begin
209221 status_setup_done_queue <= 1 ;
@@ -214,6 +226,12 @@ always @(posedge clk) begin
214226 if (target_dataslot_write & ~ target_dataslot_write_1) begin
215227 target_dataslot_write_queue <= 1 ;
216228 end
229+ if (target_dataslot_getfile & ~ target_dataslot_getfile_1) begin
230+ target_dataslot_getfile_queue <= 1 ;
231+ end
232+ if (target_dataslot_openfile & ~ target_dataslot_openfile_1) begin
233+ target_dataslot_openfile_queue <= 1 ;
234+ end
217235
218236
219237 b_datatable_wren <= 0 ;
@@ -484,6 +502,24 @@ always @(posedge clk) begin
484502 target_2C <= target_dataslot_length;
485503
486504 tstate <= TARG_ST_DATASLOTOP;
505+
506+ end else if (target_dataslot_getfile_queue) begin
507+ target_dataslot_getfile_queue <= 0 ;
508+ target_0[15 :0 ] <= 16'h0190 ;
509+
510+ target_20 <= target_dataslot_id;
511+ target_24 <= target_buffer_resp_struct; // pointer to the bram that will hold the response struct
512+ // which will contain the requested filename before command completion
513+ tstate <= TARG_ST_DATASLOTOP;
514+
515+ end else if (target_dataslot_openfile_queue) begin
516+ target_dataslot_openfile_queue <= 0 ;
517+ target_0[15 :0 ] <= 16'h0192 ;
518+
519+ target_20 <= target_dataslot_id;
520+ target_24 <= target_buffer_param_struct; // pointer to the bram that will hold the parameter struct
521+ // which must contain the desired filename and flag/size before command execution
522+ tstate <= TARG_ST_DATASLOTOP;
487523 end
488524 end
489525 TARG_ST_READYTORUN: begin
@@ -494,6 +530,7 @@ always @(posedge clk) begin
494530 target_0[31 :16 ] <= 16'h636D ;
495531
496532 target_dataslot_done <= 0 ;
533+ target_dataslot_err <= 0 ;
497534 tstate <= TARG_ST_WAITRESULT_DSO;
498535 end
499536 TARG_ST_WAITRESULT_DSO: begin
0 commit comments