@@ -43,15 +43,17 @@ proc generate {drv_handle} {
4343# parameters.
4444proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
4545 set args [::hsi::utils::get_exact_arg_list $args ]
46+
4647 set brace 0
47- array set sub_core_params {}
4848
49+ array set sub_core_params {}
4950 set sub_core_params(displayport) " BASEADDR S_AXI_ACLK LANE_COUNT LINK_RATE MAX_BITS_PER_COLOR QUAD_PIXEL_ENABLE DUAL_PIXEL_ENABLE YCRCB_ENABLE YONLY_ENABLE GT_DATAWIDTH SECONDARY_SUPPORT AUDIO_CHANNELS MST_ENABLE NUMBER_OF_MST_STREAMS PROTOCOL_SELECTION FLOW_DIRECTION"
5051 set sub_core_params(v_tc) " BASEADDR"
51- set sub_core_params(v_dual_splitter) " BASEADDR ACTIVE_COLS ACTIVE_ROWS MAX_SEGMENTS AXIS_VIDEO_MAX_TDATA_WIDTH AXIS_VIDEO_MAX_ITDATASMPLS_PER_CLK AXIS_VIDEO_MAX_OTDATASMPLS_PER_CLK MAX_OVRLAP MAX_SMPL_WIDTH HAS_AXI4_LITE HAS_IRQ "
52- set sub_core_params(hdcp) " BASEADDR S_AXI_FREQUENCY IS_RX IS_HDMI "
53- set sub_core_params(axi_timer) " BASEADDR CLOCK_FREQ_HZ "
52+ set sub_core_params(v_dual_splitter) " BASEADDR"
53+ set sub_core_params(hdcp) " BASEADDR"
54+ set sub_core_params(axi_timer) " BASEADDR"
5455 set sub_core_params(hdcp22_tx_dp) " BASEADDR"
56+ set total_subcores [array size sub_core_params]
5557
5658 set filename [file join " src" $file_name ]
5759 set config_file [open $filename w]
@@ -64,11 +66,23 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
6466
6567 set periphs_g [::hsi::utils::get_common_driver_ips $drv_handle ]
6668
69+ array set sub_core_inst {
70+ displayport 1
71+ v_tc 1
72+ v_dual_splitter 1
73+ hdcp 1
74+ axi_timer 1
75+ hdcp22_tx_dp 1
76+ }
77+
6778 foreach periph_g $periphs_g {
6879 ::hsi::current_hw_instance $periph_g ;
6980
70- set child_cells_g [::hsi::get_cells -hier ]
81+ set child_cells_g [::hsi::get_cells]
7182
83+ puts $config_file " \n /*"
84+ puts $config_file " * List of Sub-cores included from the subsystem"
85+ puts $config_file " */"
7286 foreach child_cell_g $child_cells_g {
7387 set child_cell_vlnv [::common::get_property VLNV $child_cell_g ]
7488 set vlnv_arr [split $child_cell_vlnv :]
@@ -91,6 +105,40 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
91105 }
92106 if { $is_slave != 0 } {
93107 puts -nonewline $config_file " #define [ string toupper $final_child_cell_instance_name_present_g ] \t 1\n "
108+
109+ # create dictionary for ip name and it's instance names "ip_name {inst1_name inst2_name}"
110+ dict lappend ss_ip_list $ip_name $child_cell_name_g
111+ }
112+ }
113+ }
114+
115+ puts $config_file " \n /*"
116+ puts $config_file " * List of Sub-cores excluded from the subsystem"
117+ puts $config_file " */"
118+
119+ foreach sub_core [lsort [array names sub_core_inst]] {
120+ if {[dict exists $ss_ip_list $sub_core ]} {
121+ set max_instances $sub_core_inst($sub_core)
122+ # check if core can have multiple instances
123+ # It is possible that not all instances are used in the design
124+ if {$max_instances > 1} {
125+ set ip_instances [dict get $ss_ip_list $sub_core ]
126+ set avail_instances [llength $ip_instances ]
127+
128+ # check if available instances are less than MAX
129+ # if yes, mark the missing instance
130+ # if all instances are present then skip the core
131+ if {$avail_instances < $max_instances } {
132+ set final_child_cell_instance_name_g " XPAR_${periph_g} _${strval} _PRESENT"
133+ puts -nonewline $config_file " #define [ string toupper $final_child_cell_instance_name_g ] 0\n "
134+ }
135+ }
136+ } else {
137+ set count 0
138+ while {$count <$sub_core_inst($sub_core) } {
139+ set final_child_cell_instance_name_g " XPAR_${periph_g} _${sub_core} _${count} _PRESENT"
140+ puts -nonewline $config_file " #define [ string toupper $final_child_cell_instance_name_g ] 0\n "
141+ incr count
94142 }
95143 }
96144 }
@@ -116,88 +164,119 @@ proc hier_ip_define_config_file {drv_handle file_name drv_string args} {
116164 }
117165
118166 ::hsi::current_hw_instance $periph
119- set child_cells [::hsi::get_cells -hier ]
167+ set child_cells_g [::hsi::get_cells]
120168 puts $config_file " ,\n "
121169
122- foreach child_cell $child_cells {
123- set child_cell_vlnv [::common::get_property VLNV $child_cell ]
170+ # This is to get the dictionary of included subcores.
171+ set ss_ip_list [dict create]
172+ foreach child_cell_g $child_cells_g {
173+ set child_cell_vlnv [::common::get_property VLNV $child_cell_g ]
174+ set child_cell_name_g [common::get_property NAME $child_cell_g ]
124175 set vlnv_arr [split $child_cell_vlnv :]
125176
126177 lassign $vlnv_arr ip_vendor ip_library ip_name ip_version
127178
128- set ip_type [common::get_property IP_TYPE $child_cell ]
129- set child_cell_name [common::get_property NAME $child_cell ]
130- set final_child_cell_instance_name XPAR_${child_cell_name} _DEVICE_ID
131- set final_child_cell_instance_name_present XPAR_${child_cell_name} _PRESENT
179+ set ip_type_g [common::get_property IP_TYPE $child_cell_g ]
132180
133- if { [string compare -nocase " BUS" $ip_type ] != 0 } {
134- set interfaces [hsi::get_intf_pins -of_objects $child_cell ]
181+ if {[string compare -nocase " BUS" $ip_type_g ] != 0} {
182+ set interfaces [hsi::get_intf_pins -of_objects $child_cell_g ]
135183 set is_slave 0
136184 foreach interface $interfaces {
137185 set intf_type [common::get_property TYPE $interface ]
138186 if { [string compare -nocase " SLAVE" $intf_type ] == 0 } {
139187 set is_slave 1
140188 }
141189 }
190+ if {$is_slave != 0} {
191+ # create dictionary for ip name and it's instance names "ip_name {inst1_name inst2_name}"
192+ dict lappend ss_ip_list $ip_name $child_cell_name_g
193+ }
194+ }
195+ }
142196
143- if { $is_slave != 0 } {
144- if {$ip_name == " v_tc" } {
145- if {$brace == 1} {
146- puts $config_file " \t\t\t\} ,"
147- }
148-
149- if { $brace == 0 } {
150- puts $config_file " \t\t\{ "
151- incr brace
152- }
153-
154- puts $config_file " \t\t\t\{ "
155- puts -nonewline $config_file [format " \t\t\t\t %s" [string toupper $final_child_cell_instance_name_present ]]
156- puts $config_file " ,"
157- puts $config_file " \t\t\t\t\{ "
158- puts -nonewline $config_file [format " \t\t\t\t\t %s" [string toupper $final_child_cell_instance_name ]]
159-
160- set params_str $sub_core_params($ip_name)
161- set params_arr [split $params_str " " ]
162-
163- foreach param $params_arr {
164- set final_child_cell_param_name XPAR_${child_cell_name} _$param
165- puts $config_file " ,"
166- puts -nonewline $config_file [format " \t\t\t\t\t %s" [string toupper $final_child_cell_param_name ]]
167- }
168-
169- puts $config_file " \n\t\t\t\t\} "
170- } elseif {($ip_name ne " hdcp22_cipher_dp" ) && ($ip_name ne " hdcp22_rng" )} {
171- set comma " ,\n "
172- puts $config_file " \t\t\{ "
173- puts -nonewline $config_file [format " \t\t\t %s" [string toupper $final_child_cell_instance_name_present ]]
174- puts $config_file " ,"
175- puts $config_file " \t\t\t\{ "
176- puts -nonewline $config_file [format " \t\t\t\t %s" [string toupper $final_child_cell_instance_name ]]
197+ # Check for each subcore if it is included or excluded
198+ foreach sub_core [lsort [array names sub_core_inst]] {
199+ set max_instances $sub_core_inst($sub_core)
200+
201+ if {[dict exists $ss_ip_list $sub_core ]} {
202+ # subcore include
203+ set ip_instances [dict get $ss_ip_list $sub_core ]
204+ set ip_inst_name [lindex $ip_instances 0]
205+ set final_child_cell_instance_name_present " XPAR_${ip_inst_name} _PRESENT"
206+ set final_child_cell_instance_name " XPAR_${ip_inst_name} _DEVICE_ID"
207+
208+ if {$sub_core == " v_tc" } {
209+ puts $config_file " \t\t\{ "
210+ puts $config_file " \t\t\t\{ "
211+ puts -nonewline $config_file [format " \t\t\t\t %s" [string toupper $final_child_cell_instance_name_present ]]
212+ puts $config_file " ,"
213+ puts $config_file " \t\t\t\t\{ "
214+ puts -nonewline $config_file [format " \t\t\t\t\t %s" [string toupper $final_child_cell_instance_name ]]
215+
216+ set params_str $sub_core_params($sub_core)
217+ set params_arr [split $params_str " " ]
218+
219+ foreach param $params_arr {
220+ set final_child_cell_param_name XPAR_${ip_inst_name} _$param
221+ puts $config_file " ,"
222+ puts -nonewline $config_file [format " \t\t\t\t\t %s" [string toupper $final_child_cell_param_name ]]
223+ }
177224
178- set params_str $sub_core_params($ip_name)
179- set params_arr [split $params_str " " ]
225+ puts $config_file " \n\t\t\t\t\} "
226+ puts $config_file " \t\t\t\} "
227+ puts $config_file " \t\t\} "
180228
181- foreach param $params_arr {
182- set final_child_cell_param_name XPAR_${child_cell_name} _$param
183- puts $config_file " ,"
184- puts -nonewline $config_file [format " \t\t\t\t %s" [string toupper $final_child_cell_param_name ]]
185- }
186- puts $config_file " \n\t\t\t\} "
229+ } else {
230+ set comma " ,\n "
231+ puts $config_file " \t\t\{ "
232+ puts -nonewline $config_file [format " \t\t\t %s" [string toupper $final_child_cell_instance_name_present ]]
233+ puts $config_file " ,"
234+ puts $config_file " \t\t\t\{ "
235+ puts -nonewline $config_file [format " \t\t\t\t %s" [string toupper $final_child_cell_instance_name ]]
236+
237+ set params_str $sub_core_params($sub_core)
238+ set params_arr [split $params_str " " ]
239+
240+ foreach param $params_arr {
241+ set final_child_cell_param_name XPAR_${ip_inst_name} _$param
242+ puts $config_file " ,"
243+ puts -nonewline $config_file [format " \t\t\t\t %s" [string toupper $final_child_cell_param_name ]]
244+ }
245+ puts $config_file " \n\t\t\t\} "
246+ if { $brace < $total_subcores - 1 } {
187247 puts $config_file " \t\t\} ,"
248+ incr brace
249+ } else {
250+ puts $config_file " \t\t\} "
188251 }
189252 }
253+ } else {
254+ # subcore excluded
255+ set count 0
256+ set comma " ,\n "
257+ while {$count <$max_instances } {
258+ set final_child_cell_instance_name_present " XPAR_${periph} _${sub_core} _${count} _PRESENT"
259+ puts $config_file " \t\t\{ "
260+ puts -nonewline $config_file [format " \t\t\t %s" [string toupper $final_child_cell_instance_name_present ]]
261+ puts $config_file " ,"
262+ puts $config_file " \t\t\t\{ "
263+ puts -nonewline $config_file " \t\t\t\t 0"
264+ puts $config_file " \n\t\t\t\} "
265+ if { $brace < $total_subcores - 1 } {
266+ puts $config_file " \t\t\} ,"
267+ incr brace
268+ } else {
269+ puts $config_file " \t\t\} "
270+ }
271+ incr count
272+ }
190273 }
191274 }
192275
193- if {$brace == 1} {
194- puts $config_file " \t\t\t\} "
195- puts $config_file " \t\t\} "
196- set brace 0
197- }
198-
199276 ::hsi::current_hw_instance
200277
278+ set brace 0
279+
201280 puts -nonewline $config_file " \t\} "
202281 set start_comma " ,\n "
203282 }
0 commit comments