-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path0002-v4.3.0.0-x310-add-twstft-amaranth.patch
190 lines (178 loc) · 6.5 KB
/
0002-v4.3.0.0-x310-add-twstft-amaranth.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
From d2f3017d9e5c5f66c8195eec8340d7c7a5f49cf8 Mon Sep 17 00:00:00 2001
From: Gwenhael Goavec-Merou <[email protected]>
Date: Mon, 12 Sep 2022 18:50:29 +0200
Subject: [PATCH 2/2] adding a patch for UHD to integrate twstft into X310
firmware
Signed-off-by: Gwenhael Goavec-Merou <[email protected]>
---
fpga/usrp3/top/x300/Makefile | 12 +++++
fpga/usrp3/top/x300/Makefile.x300.inc | 1 +
fpga/usrp3/top/x300/x300.v | 76 +++++++++++++++++++++++++--
fpga/usrp3/top/x300/x300.xdc | 12 ++---
4 files changed, 92 insertions(+), 9 deletions(-)
diff --git a/fpga/usrp3/top/x300/Makefile b/fpga/usrp3/top/x300/Makefile
index 76dc23bed..3a1fa9f8d 100644
--- a/fpga/usrp3/top/x300/Makefile
+++ b/fpga/usrp3/top/x300/Makefile
@@ -65,6 +65,17 @@ else
post_build = @echo "Skipping bitfile export."
endif
+TAPS?=15
+NOISELEN?=100000
+BITLEN?=17
+INVERT_FIRST_CODE?=1
+
+AMARANTH_OPTS = -v --taps $(TAPS) --noiselen $(NOISELEN) --bitlen $(BITLEN)
+
+ifeq ($(INVERT_FIRST_CODE),1)
+AMARANTH_OPTS += --invert-first-code
+endif
+
##
##Supported Targets
##-----------------
@@ -77,6 +88,7 @@ X300_IP:
##X310_IP: Build IP for X310 only.
X310_IP:
+ python -m amaranth_twstft.flashZedBoard --no-load --no-build --build-dir amaranth $(AMARANTH_OPTS)
+$(call vivado_ip,X310,$(HG_DEFS) X310=1)
##X310_1G: 1GigE on both SFP+ ports.
diff --git a/fpga/usrp3/top/x300/Makefile.x300.inc b/fpga/usrp3/top/x300/Makefile.x300.inc
index 8ad920cba..c11e2864b 100644
--- a/fpga/usrp3/top/x300/Makefile.x300.inc
+++ b/fpga/usrp3/top/x300/Makefile.x300.inc
@@ -63,6 +63,7 @@ x300_core.v \
x300_sfpp_io_core.v \
x300_zpu_config.vhd \
x300_eth_interface.v \
+amaranth/top.v \
nirio_chdr64_adapter.v \
soft_ctrl.v \
capture_ddrlvds.v \
diff --git a/fpga/usrp3/top/x300/x300.v b/fpga/usrp3/top/x300/x300.v
index 8fbfa39b9..ddbc9491c 100644
--- a/fpga/usrp3/top/x300/x300.v
+++ b/fpga/usrp3/top/x300/x300.v
@@ -168,7 +168,15 @@ module x300
//
///////////////////////////////////
- inout [11:0] FrontPanelGpio,
+ //GGM
+ //inout [11:0] FrontPanelGpio,
+ inout [5:0] FrontPanelGpio,
+ output FrontPanelGpio6, // invert prn o
+ input FrontPanelGpio7, // OUT carrier
+ output FrontPanelGpio8, // PPS
+ input FrontPanelGpio9, // ENABLE
+ output FrontPanelGpio10, // OUTPUT
+ output FrontPanelGpio11, // PPS out2
output LED_ACT1, output LED_ACT2,
output LED_LINK1, output LED_LINK2,
@@ -383,6 +391,62 @@ module x300
.CLK_OUT1(radio_clk), .CLK_OUT2(radio_clk_2x), .CLK_OUT3(dac_dci_clk),
.RESET(sw_rst[2]), .LOCKED(radio_clk_locked));
+
+ /* amaranth begin */
+ wire amaranth_clk280, amaranth_clk280_int;
+ wire amaranth_rst;
+ wire amaranth_clkfb;
+
+ MMCME2_BASE #(
+ .BANDWIDTH("OPTIMIZED"),
+ .CLKFBOUT_MULT_F(7.0),
+ .CLKFBOUT_PHASE(0.0),
+ .CLKIN1_PERIOD(32'd5),
+ .CLKOUT0_DIVIDE_F(5.0),
+ .CLKOUT0_DUTY_CYCLE(0.5),
+ .CLKOUT0_PHASE(0.0)
+ ) mmcm (
+ .CLKFBIN(amaranth_clkfb),
+ .CLKFBOUT(amaranth_clkfb),
+ .CLKIN1(radio_clk),
+ .CLKOUT0(amaranth_clk280_int),
+ .LOCKED(amaranth_rst),
+ .PWRDWN(1'h0),
+ .RST(!radio_clk_locked)
+ );
+
+ // Output buffering
+ //-----------------------------------
+ BUFG amaranth_clk280_bufg
+ (.O (amaranth_clk280),
+ .I (amaranth_clk280_int));
+
+ /* FrontPanelGpio
+ * ++
+ * ||--- +
+ * |-----| 1'b0 0 x x 1 GLOB EN
+ * | SP6 | 1'b0 2 x x 3 OUTPUT
+ * | | 1'b0 4 x x 5 PPS_IN
+ * | | 1'b0 6 x x 7 SWITCH MODE
+ * | | GND 8 x x 9 GND
+ * +-----+
+ |--- *
+ *
+ */
+ mixer mixer (
+ .clk(amaranth_clk280),
+ .global_enable(FrontPanelGpio9),
+ .output_carrier(FrontPanelGpio7),
+ .mod_out(FrontPanelGpio10),
+ .pps_in(EXT_PPS_IN),
+ .pps_out(FrontPanelGpio8),
+ .the_pps_we_love(FrontPanelGpio11),
+ .rst(!amaranth_rst),
+ .invert_prn_o(FrontPanelGpio6),
+ .switch_mode(1'b0/*FrontPanelGpio11*/)
+ );
+
+ /* amaranth end */
////////////////////////////////////////////////////////////////////
//
// IJB. Radio PLL doesn't seem to lock at power up.
@@ -1304,7 +1368,13 @@ module x300
.gpio_ddr(db1_gpio_ddr), .gpio_out(db1_gpio_out), .gpio_in(db1_gpio_in)
);
-`ifdef DEBUG_UART
+
+ gpio_atr_io #(.WIDTH(6)) fp_gpio_atr_inst (
+ .clk(radio_clk), .gpio_pins(FrontPanelGpio[5:0]),
+ .gpio_ddr(fp_gpio_ddr[5:0]), .gpio_out(fp_gpio_out[5:0]), .gpio_in(fp_gpio_in[5:0])
+ );
+ assign fp_gpio_in[11:6] = 0;
+/*`ifdef DEBUG_UART
gpio_atr_io #(.WIDTH(10)) fp_gpio_atr_inst (
.clk(radio_clk), .gpio_pins(FrontPanelGpio[9:0]),
.gpio_ddr(fp_gpio_ddr[9:0]), .gpio_out(fp_gpio_out[9:0]), .gpio_in(fp_gpio_in[9:0])
@@ -1317,7 +1387,7 @@ module x300
.gpio_ddr(fp_gpio_ddr[11:0]), .gpio_out(fp_gpio_out[11:0]), .gpio_in(fp_gpio_in[11:0])
);
assign debug_rxd = 1'b0;
-`endif
+`endif */
assign fp_gpio_in[31:12] = 20'h0;
///////////////////////////////////////////////////////////////////////////////////
diff --git a/fpga/usrp3/top/x300/x300.xdc b/fpga/usrp3/top/x300/x300.xdc
index 11290b79f..946f563a7 100644
--- a/fpga/usrp3/top/x300/x300.xdc
+++ b/fpga/usrp3/top/x300/x300.xdc
@@ -510,12 +510,12 @@ set_property PACKAGE_PIN AD28 [get_ports {FrontPanelGpio[2]}]
set_property PACKAGE_PIN AG30 [get_ports {FrontPanelGpio[3]}]
set_property PACKAGE_PIN AH30 [get_ports {FrontPanelGpio[4]}]
set_property PACKAGE_PIN AC26 [get_ports {FrontPanelGpio[5]}]
-set_property PACKAGE_PIN AD26 [get_ports {FrontPanelGpio[6]}]
-set_property PACKAGE_PIN AJ27 [get_ports {FrontPanelGpio[7]}]
-set_property PACKAGE_PIN AK28 [get_ports {FrontPanelGpio[8]}]
-set_property PACKAGE_PIN AG27 [get_ports {FrontPanelGpio[9]}]
-set_property PACKAGE_PIN AG28 [get_ports {FrontPanelGpio[10]}]
-set_property PACKAGE_PIN AH26 [get_ports {FrontPanelGpio[11]}]
+set_property PACKAGE_PIN AD26 [get_ports {FrontPanelGpio6}]
+set_property PACKAGE_PIN AJ27 [get_ports {FrontPanelGpio7}]
+set_property PACKAGE_PIN AK28 [get_ports {FrontPanelGpio8}]
+set_property PACKAGE_PIN AG27 [get_ports {FrontPanelGpio9}]
+set_property PACKAGE_PIN AG28 [get_ports {FrontPanelGpio10}]
+set_property PACKAGE_PIN AH26 [get_ports {FrontPanelGpio11}]
set_property IOSTANDARD LVCMOS33 [get_ports {FrontPanelGpio*}]
set_property PULLDOWN TRUE [get_ports {FrontPanelGpio*}]
--
2.39.1