Skip to content

Commit 172d580

Browse files
StancaPopIuliaCMoldovan
authored andcommitted
cn0577_bd.tcl: Add clk_gate_width variable
Dinamically set the PULSE_1_WIDTH parameter of the axi_ltc2387 IP, instead of hardcoding it and then overwriting it in software. Signed-off-by: Stanca Pop <stanca.pop@analog.com>
1 parent 8fed391 commit 172d580

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

projects/cn0577/common/cn0577_bd.tcl

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,14 +5,13 @@
55

66
# env params
77

8-
set ADC_RES $ad_project_params(ADC_RES); # ADC resolution; default 18 bits
9-
if {$ADC_RES == 16} {
10-
set OUT_RES 16
11-
} else {
12-
# if ADC_RES == 18
13-
set OUT_RES 32
14-
}
158
set TWOLANES $ad_project_params(TWOLANES); # two-lane mode (1) or one-lane mode (0); default two-lane
9+
set ADC_RES $ad_project_params(ADC_RES); # ADC resolution; default 18 bits
10+
set OUT_RES [expr {$ADC_RES == 16 ? 16 : 32}]
11+
set CLK_GATE_WIDTH [expr {($TWOLANES == 0 && $ADC_RES == 18) ? 9 : \
12+
($TWOLANES == 0 && $ADC_RES == 16) ? 8 : \
13+
($TWOLANES == 1 && $ADC_RES == 18) ? 5 : \
14+
4}]
1615

1716
# ltc2387 i/o
1817

@@ -41,7 +40,7 @@ ad_ip_instance axi_pwm_gen axi_pwm_gen
4140
ad_ip_parameter axi_pwm_gen CONFIG.N_PWMS 2
4241
ad_ip_parameter axi_pwm_gen CONFIG.PULSE_0_WIDTH 1
4342
ad_ip_parameter axi_pwm_gen CONFIG.PULSE_0_PERIOD 8
44-
ad_ip_parameter axi_pwm_gen CONFIG.PULSE_1_WIDTH 5
43+
ad_ip_parameter axi_pwm_gen CONFIG.PULSE_1_WIDTH $CLK_GATE_WIDTH
4544
ad_ip_parameter axi_pwm_gen CONFIG.PULSE_1_PERIOD 8
4645
ad_ip_parameter axi_pwm_gen CONFIG.PULSE_1_OFFSET 0
4746

0 commit comments

Comments
 (0)