Skip to content

Commit 0c4de3c

Browse files
committed
integrate wrap test permanently
1 parent 8a53dad commit 0c4de3c

File tree

11 files changed

+455
-286
lines changed

11 files changed

+455
-286
lines changed

adapter1/fpga/create_project.tcl

Lines changed: 94 additions & 83 deletions
Large diffs are not rendered by default.

adapter1/fpga/rtl/axi_mm_channel_out.v

Lines changed: 29 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,14 +87,20 @@ module axi_mm_channel_out (
8787

8888
input wire [1:0] m_axi_bresp,
8989
input wire m_axi_bvalid,
90-
output wire m_axi_bready
90+
output wire m_axi_bready,
91+
92+
output reg wrap_tester_enable,
93+
output reg [19:0] wrap_tester_driver,
94+
input wire [19:0] wrap_tester_receiver
9195
);
92-
localparam REG_CONTROL_1 = 8'h00;
93-
localparam REG_CONTROL_2 = 8'h04;
94-
localparam REG_STATUS_1 = 8'h08;
95-
localparam REG_STATUS_2 = 8'h0c;
96-
localparam REG_CCW_1 = 8'h10;
97-
localparam REG_CCW_2 = 8'h14;
96+
localparam REG_WRAP_TESTER_1 = 8'h00;
97+
localparam REG_WRAP_TESTER_2 = 8'h04;
98+
localparam REG_CONTROL_1 = 8'h08;
99+
localparam REG_CONTROL_2 = 8'h0c;
100+
localparam REG_STATUS_1 = 8'h10;
101+
localparam REG_STATUS_2 = 8'h14;
102+
localparam REG_CCW_1 = 8'h18;
103+
localparam REG_CCW_2 = 8'h1c;
98104

99105
initial
100106
begin
@@ -106,6 +112,8 @@ module axi_mm_channel_out (
106112
s_axi_awready = 1'b1;
107113
s_axi_wready = 1'b1;
108114
s_axi_bvalid = 1'b0;
115+
116+
wrap_tester_enable = 1'b0;
109117
end
110118

111119
reg reset = 1'b0;
@@ -185,6 +193,12 @@ module axi_mm_channel_out (
185193
s_axi_rresp <= 2'b00;
186194

187195
case (s_axi_araddr)
196+
REG_WRAP_TESTER_1:
197+
s_axi_rdata <= { wrap_tester_driver, 11'b0, wrap_tester_enable };
198+
199+
REG_WRAP_TESTER_2:
200+
s_axi_rdata <= { wrap_tester_receiver, 12'b0 };
201+
188202
REG_CONTROL_1:
189203
s_axi_rdata <= { frontend_enable, 29'b0, channel_enable, reset };
190204

@@ -262,6 +276,12 @@ module axi_mm_channel_out (
262276

263277
// TODO: should consider s_axi_wstrb
264278
case (awaddr)
279+
REG_WRAP_TESTER_1:
280+
begin
281+
wrap_tester_enable <= wdata[0];
282+
wrap_tester_driver <= wdata[31:12];
283+
end
284+
265285
REG_CONTROL_1:
266286
begin
267287
reset <= wdata[0];
@@ -319,6 +339,8 @@ module axi_mm_channel_out (
319339
s_axi_wready <= 1'b1;
320340
s_axi_bresp <= 2'b00;
321341
s_axi_bvalid <= 1'b0;
342+
343+
wrap_tester_enable <= 1'b0;
322344
end
323345
end
324346

adapter1/fpga/rtl/wrap_test.v

Lines changed: 0 additions & 120 deletions
This file was deleted.
Lines changed: 200 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,200 @@
1+
// Copyright (c) 2023, Andrew Kay
2+
//
3+
// Permission to use, copy, modify, and/or distribute this software for any
4+
// purpose with or without fee is hereby granted, provided that the above
5+
// copyright notice and this permission notice appear in all copies.
6+
//
7+
// THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
8+
// WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
9+
// MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
10+
// ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
11+
// WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
12+
// ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
13+
// OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
14+
15+
`default_nettype none
16+
17+
module wrap_tester_out (
18+
input wire clk,
19+
input wire enable,
20+
21+
input wire [19:0] driver,
22+
output reg [19:0] receiver,
23+
24+
// Parallel Channel "B"...
25+
output reg [7:0] b_bus_in,
26+
output reg b_bus_in_parity,
27+
input wire [7:0] b_bus_out,
28+
input wire b_bus_out_parity,
29+
output reg b_mark_0_in,
30+
input wire b_mark_0_out,
31+
32+
input wire b_operational_out,
33+
output reg b_request_in,
34+
input wire b_hold_out,
35+
input wire b_select_out,
36+
output reg b_select_in,
37+
input wire b_address_out,
38+
output reg b_operational_in,
39+
output reg b_address_in,
40+
input wire b_command_out,
41+
output reg b_status_in,
42+
output reg b_service_in,
43+
input wire b_service_out,
44+
input wire b_suppress_out,
45+
output reg b_data_in,
46+
input wire b_data_out,
47+
output reg b_disconnect_in,
48+
output reg b_metering_in,
49+
input wire b_metering_out,
50+
input wire b_clock_out,
51+
52+
// Parallel Channel "A"...
53+
input wire [7:0] a_bus_in,
54+
input wire a_bus_in_parity,
55+
output reg [7:0] a_bus_out,
56+
output reg a_bus_out_parity,
57+
input wire a_mark_0_in,
58+
output reg a_mark_0_out,
59+
60+
output reg a_operational_out,
61+
input wire a_request_in,
62+
output reg a_hold_out,
63+
output reg a_select_out,
64+
input wire a_select_in,
65+
output reg a_address_out,
66+
input wire a_operational_in,
67+
input wire a_address_in,
68+
output reg a_command_out,
69+
input wire a_status_in,
70+
input wire a_service_in,
71+
output reg a_service_out,
72+
output reg a_suppress_out,
73+
input wire a_data_in,
74+
output reg a_data_out,
75+
input wire a_disconnect_in,
76+
input wire a_metering_in,
77+
output reg a_metering_out,
78+
output reg a_clock_out
79+
);
80+
always @(posedge clk)
81+
begin
82+
if (enable)
83+
begin
84+
b_bus_in <= 8'b0;
85+
b_bus_in_parity <= 1'b0;
86+
b_mark_0_in <= 1'b0;
87+
b_request_in <= 1'b0;
88+
b_select_in <= b_select_out;
89+
b_operational_in <= 1'b0;
90+
b_address_in <= 1'b0;
91+
b_status_in <= 1'b0;
92+
b_service_in <= 1'b0;
93+
b_data_in <= 1'b0;
94+
b_disconnect_in <= 1'b0;
95+
b_metering_in <= 1'b0;
96+
97+
// L to R:
98+
// - Bus Out P
99+
// - Bus In P
100+
// - Bus Out 0
101+
// - Bus In 0
102+
// - Bus Out 1
103+
// - Bus In 1
104+
// - Bus Out 2
105+
// - Bus In 2
106+
// - Bus Out 3
107+
// - Bus In 3
108+
// - Bus Out 4
109+
// - Bus In 4
110+
// - Bus Out 5
111+
// - Bus In 5
112+
// - Bus Out 6
113+
// - Bus In 6
114+
// - Bus Out 7
115+
// - Bus In 7
116+
// - Mark 0 Out
117+
// - Mark 0 In
118+
//
119+
// - Operational In
120+
// - Clock Out
121+
// - Status In
122+
// - Metering Out
123+
// - Address In
124+
// - Metering In
125+
// - Service In
126+
// - Request In
127+
// - Select In
128+
// - Data In
129+
// - Select Out
130+
// - X
131+
// - Address Out
132+
// - Data Out
133+
// - Command Out
134+
// - Disconnect In
135+
// - Suppress Out
136+
// - Hold Out
137+
// - Service Out
138+
// - Operational Out
139+
140+
a_bus_out_parity <= driver[19];
141+
a_bus_out <= driver[18:11];
142+
a_mark_0_out <= driver[10];
143+
a_clock_out <= driver[9]; // -> Operational In
144+
a_metering_out <= driver[8]; // -> Status In
145+
a_data_out <= driver[5]; // -> Service In
146+
a_suppress_out <= driver[3]; // -> Disconnect In
147+
a_service_out <= driver[1]; // -> Data In
148+
a_command_out <= driver[4]; // -> Request In
149+
a_address_out <= driver[6]; // -> Metering In
150+
a_select_out <= driver[7]; // -> Address In
151+
a_hold_out <= driver[2]; // -> Select In
152+
a_operational_out <= driver[0];
153+
154+
receiver <= {
155+
a_bus_in_parity,
156+
a_bus_in,
157+
a_mark_0_in,
158+
a_operational_in,
159+
a_status_in,
160+
a_address_in,
161+
a_metering_in,
162+
a_service_in,
163+
a_request_in,
164+
a_disconnect_in,
165+
a_select_in,
166+
a_data_in,
167+
1'b0
168+
};
169+
end
170+
else
171+
begin
172+
b_bus_in <= a_bus_in;
173+
b_bus_in_parity <= a_bus_in_parity;
174+
b_mark_0_in <= a_mark_0_in;
175+
b_request_in <= a_request_in;
176+
b_select_in <= a_select_in;
177+
b_operational_in <= a_operational_in;
178+
b_address_in <= a_address_in;
179+
b_status_in <= a_status_in;
180+
b_service_in <= a_service_in;
181+
b_data_in <= a_data_in;
182+
b_disconnect_in <= a_disconnect_in;
183+
b_metering_in <= a_metering_in;
184+
185+
a_bus_out <= b_bus_out;
186+
a_bus_out_parity <= b_bus_out_parity;
187+
a_mark_0_out <= b_mark_0_out;
188+
a_operational_out <= b_operational_out;
189+
a_hold_out <= b_hold_out;
190+
a_select_out <= b_select_out;
191+
a_address_out <= b_address_out;
192+
a_command_out <= b_command_out;
193+
a_service_out <= b_service_out;
194+
a_suppress_out <= b_suppress_out;
195+
a_data_out <= b_data_out;
196+
a_metering_out <= b_metering_out;
197+
a_clock_out <= b_clock_out;
198+
end
199+
end
200+
endmodule

0 commit comments

Comments
 (0)