Module: HDLRuby::High::BlockHierarchy
Overview
Module adding show_hierarchyto block objects.
Instance Method Summary collapse
-
#get_vars_with_fullname(vars_with_fullname = {}) ⇒ Object
Gets the VCD variables with their long name.
-
#get_vars_with_idstr(vars_with_idstr = {}) ⇒ Object
Gets the VCD variables with their id string.
-
#show_hierarchy(vcdout) ⇒ Object
Shows the hierarchy of the variables.
Instance Method Details
#get_vars_with_fullname(vars_with_fullname = {}) ⇒ Object
Gets the VCD variables with their long name.
349 350 351 352 353 354 355 356 357 358 359 |
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 349 def get_vars_with_fullname(vars_with_fullname = {}) # Adds the inner signals. self.each_inner do |sig| vars_with_fullname[sig] = HDLRuby::High.vcd_name(sig.fullname) end # Recurse on the statements. self.each_statement do |stmnt| stmnt.get_vars_with_fullname(vars_with_fullname) end return vars_with_fullname end |
#get_vars_with_idstr(vars_with_idstr = {}) ⇒ Object
Gets the VCD variables with their id string.
362 363 364 365 366 367 368 369 370 371 372 |
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 362 def get_vars_with_idstr(vars_with_idstr = {}) # Adds the inner signals. self.each_inner do |sig| vars_with_idstr[sig] = HDLRuby::High.vcd_idstr(sig) end # Recurse on the statements. self.each_statement do |stmnt| stmnt.get_vars_with_idstr(vars_with_idstr) end return vars_with_idstr end |
#show_hierarchy(vcdout) ⇒ Object
Shows the hierarchy of the variables.
322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 |
# File 'lib/HDLRuby/hruby_rsim_vcd.rb', line 322 def show_hierarchy(vcdout) # puts "show_hierarchy for block=#{self}" # Shows the current level of hierarchy if there is a name. ismodule = false unless self.name.empty? vcdout << "$scope module #{HDLRuby::High.vcd_name(self.name)} $end\n" ismodule = true end # Shows the inner signals. self.each_inner do |sig| # puts "showing inner signal #{HDLRuby::High.vcd_name(sig.fullname)}" vcdout << "$var wire #{sig.type.width} " # vcdout << "#{HDLRuby::High.vcd_name(sig.fullname)} " vcdout << "#{HDLRuby::High.vcd_idstr(sig)} " vcdout << "#{HDLRuby::High.vcd_name(sig.name)} $end\n" end # Recurse on the statements self.each_statement do |stmnt| stmnt.show_hierarchy(vcdout) end # Close the current level of hierarchy if there is a name. if ismodule then vcdout << "$upscope $end\n" end end |