Professional Documents
Culture Documents
Verilog
Franco Curotto
2019
MSSGE sync_out [sync_out] in_reg d Z^-2 q [filter_acc] in_reg d Z^-2 q [a:b] [channel]
ROACH2
sync_gen filter_acc Latency = 2 channel Latency = 2
XSG_core_config sim_sync_period=12288 1input:uf32.0 = 32 bits 1input:uf32.0 = 32 bits
-2 sync
z
[acc_len] acc_len
[sync_out] -2 d Z^-1 q sync sync_out 8191 shift sync_out -2 -5 -2 d Z^-2 q -5 d Z^-1 q sync new_acc d Z^-1 q d Z^-2 q rst
z z z z z
[cnt_rst] rst
en
++
pipeline20 -2 Latency = 2 Latency = 1 Latency = 1 Latency = 2
z acc_cntrl0
a0 In1 Out1 d Z^-1 =q1
Latency pol1_in1 pol1_out1 in00 addr
X >> 2 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
pipeline19 -2 out00 -2 -5 -2 d Z^-2 q c Z^-5power d Z^-1 q -1 d Z^-1 q din valid d Z^-2 q we
z z z z z Latency =1 Latency =2
a1 In2 Out2 d Z^-1 =q1 pol1_in2 pol1_out2 in01 Latency = 1
Latency X >> 2 Latency = 2 Latency = 1 simple_bram_vacc0_0 Latency = 2 dout0_0
pipeline18 -2 addr
z
a2 In3 Out3 d Z^-1 =q1 pol1_in3 pol1_out3 in02 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
Latency X >> 2 -2 -5 -2 -1 d Z^-1 q d Z^-2 q
out01 z z z d Z^-2 q c Z^-5power d Z^-1 q z Latency =1 din valid Latency =2 we
pipeline17 -2
z Latency = 1 simple_bram_vacc0_1 Latency = 2 dout0_1
a3 In4 Out4 d Z^-1 =q1
Latency pol1_in4 pol1_out4 in03 Latency = 2 Latency = 1
X >> 2 addr
pipeline16 -2 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
sim_a z
a4 In5 Out5 d Z^-1 =q1 pol1_in5 pol1_out5 in04 out02 -2 -5 -2 d Z^-2 q c Z^-5power d Z^-1 q -1 d Z^-1 q din valid d Z^-2 q we
Latency X >> 2 z z z z Latency =1 Latency =2
-2 Latency = 1 simple_bram_vacc0_2 Latency = 2 dout0_2
pipeline15 z Latency = 2 Latency = 1
a5 In6 Out6 d Z^-1 =q1
Latency pol1_in6 pol1_out6 in05 addr
X >> 2 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
pipeline14 -2 out03 -2 -5 -2 d Z^-2 q c Z^-5power d Z^-1 q -1 d Z^-1 q din valid d Z^-2 q we
z z z z z Latency =1 Latency =2
a6 In7 Out7 d Z^-1 =q1 pol1_in7 pol1_out7 in06 Latency = 1
Latency X >> 2 Latency = 2 Latency = 1 simple_bram_vacc0_3 Latency = 2 dout0_3
pipeline13 -2 addr
z
a7 In8 Out8 d Z^-1 =q1 pol1_in8 pol1_out8 in07 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
Latency X >> 2 -2 -5 -2 -1 d Z^-1 =q1 d Z^-2 =q2
out04 z z z d Z^-2 q c Z^-5power d Z^-1 q z Latency din valid Latency we
pipeline12 -2
z Latency = 1 simple_bram_vacc0_4 Latency = 2 dout0_4
a8 In9 Out9 d Z^-1 =q1 pol1_in9 pol1_out9 in08 Latency = 2 Latency = 1
Latency X >> 2 addr
pipeline77 -2 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
z
a9 In10 Out10 d Z^-1 =q1 pol1_in10 pol1_out10 in09 out05 -2 -5 -2 d Z^-2 q c Z^-5power d Z^-1 q -1 d Z^-1 =q1
Latency din valid d Z^-2 =q2
Latency we
Latency X >> 2 z z z z
-2 Latency = 1 simple_bram_vacc0_5 Latency = 2 dout0_5
pipeline76 z Latency = 2 Latency = 1
a10 In11 Out11 d Z^-1 =q1
Latency pol1_in11 pol1_out11 in010 addr
X >> 2 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
pipeline75 -2 out06 -2 -5 -2 d Z^-2 q c Z^-5power d Z^-1 q -1 d Z^-1 =q1 din valid d Z^-2 =q2 we
z z z z z Latency Latency
a11 In12 Out12 d Z^-1 =q1 pol1_in12 pol1_out12 in011 Latency = 1
Latency X >> 2 Latency = 2 Latency = 1 simple_bram_vacc0_6 Latency = 2 dout0_6
pipeline74 -2 addr
z
a12 In13 Out13 d Z^-1 =q1 pol1_in13 pol1_out13 in012 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
1 sim_sync Latency X >> 2 -2 -5 -2 -1 d Z^-1 =q1 d Z^-2 =q2
out07 z z z d Z^-2 q c Z^-5power d Z^-1 q z Latency din valid Latency we
pipeline73 -2
z Latency = 1 simple_bram_vacc0_7 Latency = 2 dout0_7
a13 In14 Out14 d Z^-1 =q1
Latency pol1_in14 pol1_out14 in013 Latency = 2 Latency = 1
X >> 2
pipeline72 -2
Block
z
a14 In15 Out15 d Z^-1 =q1
Latency pol1_in15 pol1_out15 in014 of
X >> 2
FIR
Wrap
ADC FFT
Filter
Bandwidth: 1GHz
FFT channels: 4096
Freq. resolution: 244kHz
Dynamic Range: ∼ 86dB
Franco Curotto (DIE - U de Chile) Verilog 2019 3 / 37
¿Qué hacemos en Calán?
Aplicaciones:
Verilog:
1 module neg ( input x , output y ) ; bitstream
2 assign y = ∼x ; FPGA
3 endmodule
11 10 clk
1
1 0
0
Franco Curotto (DIE - U de Chile) Verilog 2019 6 / 37
Lógica Combinacional - Operaciones Lógicas
I Módulo: unidad básica
I Los módulos se interconectan a través de sus inputs y outputs
I Los módulos pueden contener:
I variables (wires, regs)
I lógica combinacional y/o secuencial
I otros módulos
a e
b
c
a f
b y
c
a
b g
c
a b c y
0 0 0 1
0 0 1 0
0 1 0 0
0 1 1 0
1 0 0 1
1 0 1 0
1 1 0 1
1 1 1 0
Franco Curotto (DIE - U de Chile) Verilog 2019 9 / 37
Lógica Combinacional - Bloque always
1 module truth_table ( input a ,b ,c ,
I Implementar tabla de verdad: 2 output y ) ;
always + case 3 reg [2:0] inputs_reg ;
4 reg y_reg ;
I always: 5
I Define un “bloque de 6 always @ (a ,b , c ) begin
7 inputs_reg = {a ,b , c };
procesamiento” 8
I Modifica variables reg 9 case ( inputs_reg )
I Lista de sensibilidad: define 10 3 ’ b000 : y_reg = 1;
cuándo se ‘activa’ el bloque 11 3 ’ b001 : y_reg = 0;
12 3 ’ b010 : y_reg = 0;
13 3 ’ b011 : y_reg = 0;
a b c y 14 3 ’ b100 : y_reg = 1;
0 0 0 1 15 3 ’ b101 : y_reg = 0;
0 0 1 0 16 3 ’ b110 : y_reg = 1;
0 1 0 0 17 3 ’ b111 : y_reg = 0;
0 1 1 0 18 default : y_reg = 0;
19 endcase
1 0 0 1
20 end
1 0 1 0 21
1 1 0 1 22 assign y = y_reg ;
1 1 1 0 23 endmodule
Franco Curotto (DIE - U de Chile) Verilog 2019 9 / 37
Lógica Combinacional - Bloque always
I {,}: operación de concatenación
I reg:
I Conserva su valor de una asignación a la siguiente
I Solo se puede modificar dentro de un bloque always
I No necesariamente representa un registro (memoria)!
¿Cuántos ciclos de reloj deben transcurrir para que para que reg3 tome el
valor 1 en ambos casos?
J Q
T Q
Q
K Q
T Qn+1 J K Qn+1
0 Qn 0 0 Qn
1 ∼ Qn 0 1 0
1 0 1
1 1 ∼ Qn
0
start
1
00 01
0 0
0
0 1
1
11 10
1
1 0
0
I Debemos crear:
1 module adder_16bit ( input [15:0] a , b , input Cin ,
2 output [15:0] sum , output Cout ) ;
Diagrama:
adder 8bits concat
a[7:0] a 8 )
sum / 16
b[7:0] b / sum
Cout
Cin Cin
carry wire
adder 8bits
a[15:8] a 8
sum /
b[15:8] b
Cout / Cout
Cin 1
Ventajas:
I Menor barrera de entrada
I Fácil de visualizar flujo de datos
I Rápido para diseños simples
Ventajas: Desventajas
I Menor barrera de entrada I Tedioso de programar para
I Fácil de visualizar flujo de datos diseños grandes
I Rápido para diseños simples I Requiere más tiempo de
compilación/sı́ntesis
I Dificil de parametrizar
I Menos portable
Franco Curotto (DIE - U de Chile) Verilog 2019 25 / 37
Programación Gráfica vs Textual
Programación gráfica:
adc0_data_valid
[sync_gen] d Z^-1 q sync_in
adc1_s0 d Z^-1 =q1
Latency real1 [acc_len] acc_len
-2 -2 -5 -2 d Z^-2 q -5 d Z^-1 q sync new_acc d Z^-1 q d Z^-2 q rst
z z z z z
Latency = 1 0 imag1 [cnt_rst] rst en ++ addr
adc1_s1 d Z^-1 q real2 -2 sel Latency = 2 Latency = 1 Latency = 1 Latency = 2
z acc_cntrl1 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
sync_out d Z^-1 q sync sync_out xk_re reinterpret cast re
1 adc1_data_valid_sim Latency = 1 0 imag2 -1 xn_re
z -2 c d0 -2 -5 -2 d Z^-2 q c Z^-5 power d Z^-1 q -1 Latency
d Z^-1 =q1 din valid Latency
d Z^-2 =q2 we
adc1_s2 d Z^-1 q real3 Latency = 1 z z z z z
xk_im reinterpret cast im
Latency = 1 0 imag3 Latency = 2 Latency = 1 Latency = 1 simple_bram_vacc1_0 Latency = 2 dout1_0
0 d1
adc1_s3 d Z^-1 q real4 xn_index
0 xn_im
Latency = 1 0 imag4 -2
adc1_s4 d Z^-1 q real5
xk_index a z
d 2047 b a>b
Latency = 1 0 imag5 [cnt_rst] rst z-1 q start rfd
adc1_s5 d Z^-1 q real6 en
sim_adc0_data_in
0 imag6
re d Z^-1 q pol1_in1 pol1_out1
busy
Latency = 1 dout c reset_reg1
im Latency = 1
adc1_s6 d Z^-1 q real7
1 fwd_inv
0 imag7 c_to_ri4 dv
Latency = 1
adc1_s7 d Z^-1 q real8 8_7 r/i
edone
Latency = 1 0 imag8
pfb_fir_real1 0 fwd_inv_we
adc1_sync
taps=4, add_latency=1 done
dec_fir1
104 taps FFT1
adc1_outofrange
sim_adc1_data_in 8_7 r/i
adc1_data_valid
Decimation PFB FIR Xilinx FFT [acc_len]
FIR Filter
adc083000x2 acc_len
-2 d Z^-2 q -5 d Z^-1 q sync new_acc d Z^-1 q d Z^-2 q rst
z z
en ++
[cnt_rst] addr
rst
Latency = 2 Latency = 1 Latency = 1 Latency = 2
ADC
acc_cntrl2 d Z^-1 q new_acc dout d Z^-2 q reinterpret data_in data_out
a
a Z^-2 a-b Latency
d Z^-2 q c Z^-5power d Z^-1 q -1 d Z^-1 =q1 din valid Latency
d Z^-2 =q2 we
Filter
ab b z
[weig0] b Latency = 2 Latency = 1 Latency = 1 simple_bram_vacc2_0 Latency = 2
18_17 * 18_17 ==> 18_17 dout2_0
18_17 * 64_35 ==> 18_17 Truncate, Wrap
Round (unbiased: Even Values), Wrap Latency=2
Latency=0
z
-5
z
-1 d Z^-1 q d Z^-2 q z
-5 d Z^-2 q ++
rst a
Latency = 1 Latency = 2 Latency = 2 weig_addr a-b
++
rst b
Adaptive Filter
Latency=0 64_35, Signed ri_to_c5
c_to_ri Round (unbiased: +/- Inf), Wrap
37_35 r/i
Franco Curotto
2019