Skip to content

Commit 85b5fea

Browse files
v1.2.0
1 parent b6bc79f commit 85b5fea

File tree

10 files changed

+186
-39
lines changed

10 files changed

+186
-39
lines changed

core.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,8 @@
77
"description": "APF core template. Displays gray test screen.",
88
"author": "Developer",
99
"url": "https://github.com/open-fpga/core-template",
10-
"version": "1.1.0",
11-
"date_release": "2022-08-23"
10+
"version": "1.2.0",
11+
"date_release": "2022-11-05"
1212
},
1313
"framework": {
1414
"target_product": "Analogue Pocket",

output/bitstream.rbf_r

1.7 KB
Binary file not shown.

src/fpga/ap_core.qsf

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -744,5 +744,9 @@ set_global_assignment -name SDC_FILE core/core_constraints.sdc
744744
set_global_assignment -name SIGNALTAP_FILE core/stp1.stp
745745
set_global_assignment -name QIP_FILE core/mf_pllbase.qip
746746
set_global_assignment -name SIP_FILE core/mf_pllbase.sip
747-
set_global_assignment -name SLD_FILE db/stp1_auto_stripped.stp
748-
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
747+
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_1wire
748+
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_spiclk
749+
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_spimiso
750+
set_instance_assignment -name WEAK_PULL_UP_RESISTOR ON -to bridge_spimosi
751+
set_instance_assignment -name PARTITION_HIERARCHY root_partition -to | -section_id Top
752+
set_global_assignment -name SLD_FILE db/stp1_auto_stripped.stp

src/fpga/apf/apf_top.v

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -280,10 +280,10 @@ mf_ddio_bidir_12 isclk(
280280

281281

282282
// controller data (pad) controller.
283-
wire [15:0] cont1_key;
284-
wire [15:0] cont2_key;
285-
wire [15:0] cont3_key;
286-
wire [15:0] cont4_key;
283+
wire [31:0] cont1_key;
284+
wire [31:0] cont2_key;
285+
wire [31:0] cont3_key;
286+
wire [31:0] cont4_key;
287287
wire [31:0] cont1_joy;
288288
wire [31:0] cont2_joy;
289289
wire [31:0] cont3_joy;

src/fpga/apf/build_id.mif

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,8 @@ DATA_RADIX = HEX;
99
CONTENT
1010
BEGIN
1111

12-
0E0 : 20220823;
13-
0E1 : 00024957;
14-
0E2 : b7d9142a;
12+
0E0 : 20221025;
13+
0E1 : 00195120;
14+
0E2 : 3c157f76;
1515

1616
END;

src/fpga/apf/io_pad_controller.v

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,10 @@ input wire reset_n,
4545

4646
inout reg pad_1wire,
4747

48-
output reg [15:0] cont1_key,
49-
output reg [15:0] cont2_key,
50-
output reg [15:0] cont3_key,
51-
output reg [15:0] cont4_key,
48+
output reg [31:0] cont1_key,
49+
output reg [31:0] cont2_key,
50+
output reg [31:0] cont3_key,
51+
output reg [31:0] cont4_key,
5252
output reg [31:0] cont1_joy,
5353
output reg [31:0] cont2_joy,
5454
output reg [31:0] cont3_joy,
@@ -140,19 +140,19 @@ always @(posedge clk) begin
140140
if(rx_word_done) begin
141141
cnt <= cnt + 1'b1;
142142
case(cnt)
143-
0: cont1_key <= rx_word[15:0];
143+
0: cont1_key <= rx_word;
144144
1: cont1_joy <= rx_word;
145145
2: cont1_trig <= rx_word[15:0];
146146

147-
3: cont2_key <= rx_word[15:0];
147+
3: cont2_key <= rx_word;
148148
4: cont2_joy <= rx_word;
149149
5: cont2_trig <= rx_word[15:0];
150150

151-
6: cont3_key <= rx_word[15:0];
151+
6: cont3_key <= rx_word;
152152
7: cont3_joy <= rx_word;
153153
8: cont3_trig <= rx_word[15:0];
154154

155-
9: cont4_key <= rx_word[15:0];
155+
9: cont4_key <= rx_word;
156156
10: cont4_joy <= rx_word;
157157
11: begin
158158
cont4_trig <= rx_word[15:0];

src/fpga/core/core_bridge_cmd.v

Lines changed: 111 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,21 @@ input wire dataslot_requestread_ok,
4040

4141
output reg dataslot_requestwrite,
4242
output reg [15:0] dataslot_requestwrite_id,
43+
output reg [31:0] dataslot_requestwrite_size,
4344
input wire dataslot_requestwrite_ack,
4445
input wire dataslot_requestwrite_ok,
4546

47+
output reg dataslot_update,
48+
output reg [15:0] dataslot_update_id,
49+
output reg [31:0] dataslot_update_size,
50+
4651
output reg dataslot_allcomplete,
4752

53+
output reg [31:0] rtc_epoch_seconds,
54+
output reg [31:0] rtc_date_bcd,
55+
output reg [31:0] rtc_time_bcd,
56+
output reg rtc_valid,
57+
4858
input wire savestate_supported,
4959
input wire [31:0] savestate_addr,
5060
input wire [31:0] savestate_size,
@@ -64,6 +74,18 @@ input wire savestate_load_busy,
6474
input wire savestate_load_ok,
6575
input wire savestate_load_err,
6676

77+
input wire target_dataslot_read, // rising edge triggered
78+
input wire target_dataslot_write,
79+
80+
output reg target_dataslot_ack, // asserted upon command start until completion
81+
output reg target_dataslot_done, // asserted upon command finish until next command is issued
82+
output reg [2:0] target_dataslot_err, // contains result of command execution. zero is OK
83+
84+
input wire [15:0] target_dataslot_id, // parameters for each of the read/reload/write commands
85+
input wire [31:0] target_dataslot_slotoffset,
86+
input wire [31:0] target_dataslot_bridgeaddr,
87+
input wire [31:0] target_dataslot_length,
88+
6789
input wire [9:0] datatable_addr,
6890
input wire datatable_wren,
6991
input wire [31:0] datatable_data,
@@ -146,37 +168,53 @@ localparam [3:0] ST_DONE_ERR = 'd15;
146168

147169
localparam [3:0] TARG_ST_IDLE = 'd0;
148170
localparam [3:0] TARG_ST_READYTORUN = 'd1;
149-
localparam [3:0] TARG_ST_DISPMSG = 'd2;
150-
localparam [3:0] TARG_ST_SLOTREAD = 'd3;
151-
localparam [3:0] TARG_ST_SLOTRELOAD = 'd4;
152-
localparam [3:0] TARG_ST_SLOTWRITE = 'd5;
153-
localparam [3:0] TARG_ST_SLOTFLUSH = 'd6;
154-
localparam [3:0] TARG_ST_WAITRESULT = 'd15;
171+
localparam [3:0] TARG_ST_DATASLOTOP = 'd2;
172+
localparam [3:0] TARG_ST_WAITRESULT_RTR = 'd14;
173+
localparam [3:0] TARG_ST_WAITRESULT_DSO = 'd15;
155174
reg [3:0] tstate;
156175

157-
reg status_setup_done_1;
158-
reg status_setup_done_queue;
176+
reg status_setup_done_1, status_setup_done_queue;
177+
reg target_dataslot_read_1, target_dataslot_read_queue;
178+
reg target_dataslot_write_1, target_dataslot_write_queue;
159179

160180

161181
initial begin
162182
reset_n <= 0;
163183
dataslot_requestread <= 0;
164184
dataslot_requestwrite <= 0;
185+
dataslot_update <= 0;
165186
dataslot_allcomplete <= 0;
187+
rtc_valid <= 0;
166188
savestate_start <= 0;
167189
savestate_load <= 0;
168190
osnotify_inmenu <= 0;
191+
169192
status_setup_done_queue <= 0;
193+
target_dataslot_read_queue <= 0;
194+
target_dataslot_write_queue <= 0;
195+
target_dataslot_ack <= 0;
196+
target_dataslot_done <= 0;
197+
target_dataslot_err <= 0;
170198
end
171199

172200
always @(posedge clk) begin
173201

174202
// detect a rising edge on the input signal
175203
// and flag a queue that will be cleared later
176204
status_setup_done_1 <= status_setup_done;
205+
target_dataslot_read_1 <= target_dataslot_read;
206+
target_dataslot_write_1 <= target_dataslot_write;
207+
177208
if(status_setup_done & ~status_setup_done_1) begin
178209
status_setup_done_queue <= 1;
179210
end
211+
if(target_dataslot_read & ~target_dataslot_read_1) begin
212+
target_dataslot_read_queue <= 1;
213+
end
214+
if(target_dataslot_write & ~target_dataslot_write_1) begin
215+
target_dataslot_write_queue <= 1;
216+
end
217+
180218

181219
b_datatable_wren <= 0;
182220
b_datatable_addr <= bridge_addr >> 2;
@@ -257,6 +295,7 @@ always @(posedge clk) begin
257295

258296
dataslot_requestread <= 0;
259297
dataslot_requestwrite <= 0;
298+
dataslot_update <= 0;
260299
savestate_start <= 0;
261300
savestate_load <= 0;
262301

@@ -314,17 +353,34 @@ always @(posedge clk) begin
314353
dataslot_allcomplete <= 0;
315354
dataslot_requestwrite <= 1;
316355
dataslot_requestwrite_id <= host_20[15:0];
356+
dataslot_requestwrite_size <= host_24;
317357
if(dataslot_requestwrite_ack) begin
318358
host_resultcode <= 0;
319359
if(!dataslot_requestwrite_ok) host_resultcode <= 2;
320360
hstate <= ST_DONE_CODE;
321361
end
322362
end
363+
16'h008A: begin
364+
// Data slot update (sent on deferload marked slots only)
365+
dataslot_update <= 1;
366+
dataslot_update_id <= host_20[15:0];
367+
dataslot_update_size <= host_24;
368+
hstate <= ST_DONE_OK;
369+
end
323370
16'h008F: begin
324371
// Data slot access all complete
325372
dataslot_allcomplete <= 1;
326373
hstate <= ST_DONE_OK;
327374
end
375+
16'h0090: begin
376+
// Real-time Clock Data
377+
// user logic should detect rising edge, it is not continuously updated
378+
rtc_valid <= 1;
379+
rtc_epoch_seconds <= host_20;
380+
rtc_date_bcd <= host_24;
381+
rtc_time_bcd <= host_28;
382+
hstate <= ST_DONE_OK;
383+
end
328384
16'h00A0: begin
329385
// Savestate: Start/Query
330386
host_40 <= savestate_supported;
@@ -397,22 +453,63 @@ always @(posedge clk) begin
397453
endcase
398454

399455

400-
401-
402456
// target > host command executer
403457
case(tstate)
404458
TARG_ST_IDLE: begin
459+
460+
target_dataslot_ack <= 0;
461+
405462
if(status_setup_done_queue) begin
406463
status_setup_done_queue <= 0;
407464
tstate <= TARG_ST_READYTORUN;
408-
end
409-
465+
466+
end else if(target_dataslot_read_queue) begin
467+
target_dataslot_read_queue <= 0;
468+
target_0[15:0] <= 16'h0180;
469+
470+
target_20 <= target_dataslot_id;
471+
target_24 <= target_dataslot_slotoffset;
472+
target_28 <= target_dataslot_bridgeaddr;
473+
target_2C <= target_dataslot_length;
474+
475+
tstate <= TARG_ST_DATASLOTOP;
476+
477+
end else if(target_dataslot_write_queue) begin
478+
target_dataslot_write_queue <= 0;
479+
target_0[15:0] <= 16'h0184;
480+
481+
target_20 <= target_dataslot_id;
482+
target_24 <= target_dataslot_slotoffset;
483+
target_28 <= target_dataslot_bridgeaddr;
484+
target_2C <= target_dataslot_length;
485+
486+
tstate <= TARG_ST_DATASLOTOP;
487+
end
410488
end
411489
TARG_ST_READYTORUN: begin
412490
target_0 <= 32'h636D_0140;
413-
tstate <= TARG_ST_WAITRESULT;
491+
tstate <= TARG_ST_WAITRESULT_RTR;
492+
end
493+
TARG_ST_DATASLOTOP: begin
494+
target_0[31:16] <= 16'h636D;
495+
496+
target_dataslot_done <= 0;
497+
tstate <= TARG_ST_WAITRESULT_DSO;
498+
end
499+
TARG_ST_WAITRESULT_DSO: begin
500+
if(target_0[31:16] == 16'h6275) begin
501+
target_dataslot_ack <= 1;
502+
end
503+
if(target_0[31:16] == 16'h6F6B) begin
504+
// done
505+
// save result code
506+
target_dataslot_err <= target_0[2:0];
507+
// assert done
508+
target_dataslot_done <= 1;
509+
tstate <= TARG_ST_IDLE;
510+
end
414511
end
415-
TARG_ST_WAITRESULT: begin
512+
TARG_ST_WAITRESULT_RTR: begin
416513
if(target_0[31:16] == 16'h6F6B) begin
417514
// done
418515
tstate <= TARG_ST_IDLE;

0 commit comments

Comments
 (0)