Skip to content

Commit 35e5a6e

Browse files
modustollensjynik
authored andcommitted
hdl: Added ATSC TX FPGA implementation
This revision introduces an FPGA-based ATSC transmitter to offload the pilot insertion, filtering, and shift to baseband. This design expects that 4-bit ATSC symbols are written to the device in little-endian 32-bit words, as shown below. |<------- 32 Bit Word ------->| Bit |31|30|29|28|27|26|25|24|23|22|21|20|19|18|17|16|15|14|13|12|11|10|09|08|07|06|05|04|03|02|01|00| Symbol [ X| 7 ][X| 6 ][X| 5 ][X| 4 ][X| 3 ][X| 2 ][X| 1 ][X| 0 ] The FPGA transmits Symbol 0 first, and Symbol 7 last. The three least-significant bits in each symbol's nibble contain values 0 to 7, mapping to values of -7 to 7, with the most-significant bit left unused. This FPGA image may be built by specifying the "atsc_tx" image to the build_bladerf.sh script. The resulting output files will be atsc_txx40.rbf and atsc_txx115.rbf for the x40 and the x115, respectively. Transmitting a pre-made stream on channel 14-1 can be achieved with the following commands in the bladeRF-cli: set frequency 473000000 set samplerate 32286713 2867 10000 set txvga1 -4 set txvga2 20 tx config file=<path to file> repeat=0 delay=0 tx start
1 parent dfa9f51 commit 35e5a6e

14 files changed

+2535
-47
lines changed

hdl/fpga/ip/nuand/nuand.do

+12
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
proc compile_nuand { root } {
22
vlib nuand
33

4+
vcom -work nuand -2008 [file join $root ../altera/tx_fifo/tx_fifo.vhd]
5+
6+
47
vcom -work nuand -2008 [file join $root ./synthesis/constellation_mapper.vhd]
58
vcom -work nuand -2008 [file join $root ./synthesis/sync_fifo.vhd]
69
vcom -work nuand -2008 [file join $root ./synthesis/uart.vhd]
@@ -18,7 +21,16 @@ proc compile_nuand { root } {
1821
vcom -work nuand -2008 [file join $root ./synthesis/handshake.vhd]
1922
vcom -work nuand -2008 [file join $root ./synthesis/tb/handshake_tb.vhd]
2023

24+
vcom -work nuand -2008 [file join $root ./synthesis/signal_processing_p.vhd]
25+
26+
vcom -work nuand -2008 [file join $root ./synthesis/bit_stripper.vhd]
27+
vcom -work nuand -2008 [file join $root ./synthesis/fir_filter.vhd]
28+
vcom -work nuand -2008 [file join $root ./synthesis/atsc_tx.vhd]
2129
vcom -work nuand -2008 [file join $root ./simulation/util.vhd]
30+
vcom -work nuand -2008 [file join $root ./synthesis/tb/fir_filter_tb.vhd]
31+
32+
vcom -work nuand -2008 [file join $root ./synthesis/tb/atsc_tx_tb.vhd]
33+
2234
vcom -work nuand -2008 [file join $root ./simulation/fx3_model.vhd]
2335
vcom -work nuand -2008 [file join $root ./simulation/lms6002d_model.vhd]
2436
}

hdl/fpga/ip/nuand/simulation/util.vhd

+170
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
library ieee ;
22
use ieee.std_logic_1164.all ;
33

4+
library std;
5+
use std.textio.all;
6+
7+
48
-- Utility package
59
package util is
610

@@ -19,3 +23,169 @@ package body util is
1923

2024
end package body ;
2125

26+
library ieee ;
27+
use ieee.std_logic_1164.all ;
28+
use ieee.numeric_std.all;
29+
library std;
30+
use std.textio.all;
31+
32+
33+
entity data_saver is
34+
generic(
35+
FILENAME : string := "file.dat";
36+
DATA_WIDTH : natural := 16
37+
);
38+
port(
39+
reset : in std_logic;
40+
clock : in std_logic;
41+
data : std_logic_vector(DATA_WIDTH-1 downto 0);
42+
data_valid : std_logic
43+
);
44+
end entity;
45+
46+
47+
architecture arch of data_saver is
48+
begin
49+
50+
handler : process
51+
FILE fp : text;
52+
variable line_data : line;
53+
begin
54+
--
55+
wait until falling_edge(reset);
56+
57+
file_open(fp, FILENAME, WRITE_MODE);
58+
59+
while (reset = '0') loop
60+
wait until rising_edge(data_valid);
61+
write(line_data, data);
62+
writeline(fp,line_data);
63+
end loop;
64+
file_close(fp);
65+
end process;
66+
end architecture;
67+
68+
69+
library ieee ;
70+
use ieee.std_logic_1164.all ;
71+
use ieee.numeric_std.all;
72+
library std;
73+
use std.textio.all;
74+
75+
76+
entity signed_saver is
77+
generic(
78+
FILENAME : string := "file.dat";
79+
DATA_WIDTH : natural := 16
80+
);
81+
port(
82+
reset : in std_logic;
83+
clock : in std_logic;
84+
data : signed(DATA_WIDTH-1 downto 0);
85+
data_valid : std_logic
86+
);
87+
end entity;
88+
89+
90+
architecture arch of signed_saver is
91+
begin
92+
93+
handler : process
94+
FILE fp : text;
95+
variable line_data : line;
96+
begin
97+
--
98+
wait until falling_edge(reset);
99+
100+
file_open(fp, FILENAME, WRITE_MODE);
101+
102+
while (reset = '0') loop
103+
wait until rising_edge(clock);
104+
105+
if data_valid = '1' then
106+
write(line_data, (to_integer(data)));
107+
writeline(fp,line_data);
108+
end if;
109+
end loop;
110+
file_close(fp);
111+
end process;
112+
end architecture;
113+
114+
115+
116+
library ieee ;
117+
use ieee.std_logic_1164.all ;
118+
use ieee.numeric_std.all;
119+
library std;
120+
use std.textio.all;
121+
122+
123+
entity data_reader is
124+
generic(
125+
FILENAME : string := "file.dat";
126+
DATA_WIDTH : natural := 16
127+
);
128+
port(
129+
reset : in std_logic;
130+
clock : in std_logic;
131+
data_request : in std_logic;
132+
data : out std_logic_vector(DATA_WIDTH-1 downto 0);
133+
data_valid : out std_logic
134+
);
135+
end entity;
136+
137+
138+
architecture arch of data_reader is
139+
140+
type character_array_t is array (natural range <>) of character;
141+
begin
142+
143+
handler : process
144+
variable line_data : line;
145+
variable tmp : integer;
146+
variable c : character;--_array_t(0 to 3);
147+
148+
type bin_t is file of character ;
149+
file fp : bin_t ;
150+
variable fs : file_open_status ;
151+
begin
152+
--
153+
data <= (others => '0');
154+
data_valid <= '0';
155+
wait until falling_edge(reset);
156+
157+
file_open(fs, fp, FILENAME, READ_MODE);
158+
159+
if( fs /= OPEN_OK ) then
160+
report "File open issues" severity failure ;
161+
end if ;
162+
163+
--readline(fp,line_data);
164+
while (reset = '0') loop
165+
166+
wait until rising_edge(clock);
167+
data_valid <= '0';
168+
169+
if data_request = '1' then
170+
read(fp, c);
171+
tmp := integer(natural(character'pos(c)));
172+
data(7 downto 0) <= std_logic_vector(to_unsigned(tmp,8));
173+
read(fp, c);
174+
tmp := integer(natural(character'pos(c)));
175+
data(15 downto 8) <= std_logic_vector(to_unsigned(tmp,8));
176+
read(fp, c);
177+
tmp := integer(natural(character'pos(c)));
178+
data(23 downto 16) <= std_logic_vector(to_unsigned(tmp,8));
179+
read(fp, c);
180+
tmp := integer(natural(character'pos(c)));
181+
data(31 downto 24) <= std_logic_vector(to_unsigned(tmp,8));
182+
183+
data_valid <= '1';
184+
wait until rising_edge(clock);
185+
data_valid <= '0';
186+
end if;
187+
188+
end loop;
189+
file_close(fp);
190+
end process;
191+
end architecture;

0 commit comments

Comments
 (0)