Ejemplo n.º 1
0
    def __init__(self, parent):

        #
        # Build and display the hierarchy treecontrol
        #
        gizmos.TreeListCtrl.__init__(self,
                                     parent,
                                     style=wx.TR_DEFAULT_STYLE
                                     | wx.TR_FULL_ROW_HIGHLIGHT
                                     | wx.TR_HIDE_ROOT)

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectModule)

        self.file_to_load = None
        self.cur_hier_path = ''
        self.cur_module_ref = ''

        #
        # Read in a few verilog models that are hierarchical
        #
        rtl_files = [
            '../../tests/rtl/trivial/top.v', '../../tests/rtl/trivial/a.v',
            '../../tests/rtl/trivial/b.v'
        ]

        myparser = hdl_parser()
        for rtl_file in rtl_files:
            myparser.build_cds_from_file(rtl_file)

        # Get the module dictionary
        self.module_dict = myparser.cds

        #
        # Image List stuff
        #
        image_size = (16, 16)
        image_list = wx.ImageList(image_size[0], image_size[1])
        self.green_id = image_list.Add(images_marty.getGreenBitmap())
        self.red_id = image_list.Add(images_marty.getRedBitmap())
        self.black_id = image_list.Add(images_marty.getBlackBitmap())
        self.blue_id = image_list.Add(images_marty.getBlueBitmap())

        self.SetImageList(image_list)
        self.image_list = image_list  # what's this for?

        # create some columns
        self.AddColumn("Hierarchy Tree")
        self.AddColumn("Module Name")
        self.SetMainColumn(0)  # the one with the tree in it...
        self.SetColumnWidth(0, 175)

        self.root = self.AddRoot("_top")
        self.SetItemText(self.root, "None", 1)
        self.SetItemImage(self.root,
                          self.green_id,
                          which=wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root,
                          self.blue_id,
                          which=wx.TreeItemIcon_Expanded)

        #
        # Now build the hierarchy
        #
        if not self.module_dict.values():
            print 'arrrrrgggghhhhh!!'

        #  Build a list of module names referenced in each of the
        # modules.  Any modules in the module list not in the referenced
        # module list are toplevel modules which need to be traversed
        module_ref_list = []
        for module in self.module_dict.values():
            for inst in module.inst_dict.values():
                module_ref_list.append(inst.module_ref)

        #
        for module in self.module_dict.values():
            if module.name in module_ref_list:
                #  A referenced (instanciated) module, which are not
                # added to the root of the tree
                continue

            self.AddModule(self.root, module, module.name)

        # Expand the root?
        self.Expand(self.root)

        # Select the first module and display the code for it
        first_module, cookie = self.GetFirstChild(self.root)
        self.SelectItem(first_module)
        self.UpdateHierInfo()
Ejemplo n.º 2
0
    def __init__(self, parent):
    
        #
        # Build and display the hierarchy treecontrol
        #
        gizmos.TreeListCtrl.__init__(self, parent,
                                     style = wx.TR_DEFAULT_STYLE
                                            | wx.TR_FULL_ROW_HIGHLIGHT
                                            | wx.TR_HIDE_ROOT
                                     )

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectModule)

        self.file_to_load   = None
        self.cur_hier_path  = ''
        self.cur_module_ref = None
        
        #
        # Read in a few verilog models that are hierarchical
        #
        if True:
            rtl_files = [
                         'tests/rtl/trivial/top.v',
                         'tests/rtl/trivial/a.v',
                         'tests/rtl/trivial/b.v',
                         'tests/rtl/trivial_clk_rstb/top_clk_rstb.v',
                         'tests/rtl/trivial_clk_rstb/a_clk_rstb.v',
                         'tests/rtl/trivial_clk_rstb/b_clk_rstb.v',
                         'tests/rtl/spider/four_in_four_out.v',
                         'tests/rtl/spider/one_in_one_out.v',
                         'tests/rtl/spider/spider.v',
                         'tests/rtl/spider/two_in_two_out.v',  
                         'tests/rtl/spider/one_in_two_out.v',
                         'tests/rtl/spider/two_in_one_out.v',
                         'tests/rtl/spider/spider_2.v',
                         'tests/rtl/gates/and2.v',
                         'tests/rtl/gates/inv.v',
                         'tests/rtl/gates/gates1.v',
                         'tests/rtl/gates/gates2.v',
                         'tests/rtl/gates/gates3.v',
                         "tests/rtl/snake/one_in_four_out.v",
                         "tests/rtl/snake/snake_1.v",
                         "tests/rtl/snake/three_in_one_out.v",
                         "tests/rtl/snake/two_in_three_out.v",
                         "tests/rtl/snake/two_in_two_out.v",
                         "tests/rtl/snake/two_in_one_out.v",
                         "tests/rtl/long_traces/long_1.v",
                         "tests/rtl/long_traces/long_2.v",
                         "tests/rtl/long_traces/one_in_three_out.v",
                         "tests/rtl/feedback/feedback_1.v",
                         "tests/rtl/feedback/feedback_2.v",
                         "tests/rtl/feedback/feedback_3.v",
                         "tests/rtl/feedback/three_in_three_out.v",
                         ]
        else:               
            rtl_files = [
                         'tests/rtl/trivial/top.v',
                         'tests/rtl/trivial/a.v',
                         'tests/rtl/trivial/b.v',
                         'tests/rtl/gates/and2.v',
                         'tests/rtl/gates/inv.v',
                         'tests/rtl/gates/gates1.v',
                         'tests/rtl/gates/gates2.v',
                         'tests/rtl/gates/gates3.v',
                         ]            

        myparser = hdl_parser()
        for rtl_file in rtl_files:
            myparser.build_cds_from_file( rtl_file )

        # Get the module dictionary
        self.module_dict = myparser.cds


        #
        # Image List stuff
        #
        image_size = (16,16)
        image_list = wx.ImageList(image_size[0], image_size[1])
        self.green_id  = image_list.Add( hier_tree_icons.getGreenBitmap() )
        self.red_id    = image_list.Add( hier_tree_icons.getRedBitmap()   )
        self.black_id  = image_list.Add( hier_tree_icons.getBlackBitmap() )
        self.blue_id   = image_list.Add( hier_tree_icons.getBlueBitmap()  )

        self.SetImageList(image_list)
        self.image_list = image_list  # what's this for?

        # create some columns
        self.AddColumn("Hierarchy Tree")
        self.AddColumn("Module Name")
        self.SetMainColumn(0) # the one with the tree in it...
        self.SetColumnWidth(0, 175)


        self.root = self.AddRoot("_top")
        self.SetItemText(self.root, "None", 1)
        self.SetItemImage(self.root, self.green_id, which = wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root, self.blue_id, which = wx.TreeItemIcon_Expanded)


        
        #
        # Now build the hierarchy
        #
        if not self.module_dict.values():
            print 'arrrrrgggghhhhh!!'

        #  Build a list of module names referenced in each of the
        # modules.  Any modules in the module list not in the referenced
        # module list are toplevel modules which need to be traversed
        module_ref_list = []
        for module in self.module_dict.values():
            for inst in module.inst_dict.values():
                
                # See if inst.module_ref_name string corresponds to an actual vv.Module
                if inst.module_ref_name in self.module_dict:
                    inst.module_ref = self.module_dict[inst.module_ref_name]
                    # Build the module list ref
                    module_ref_list.append( inst.module_ref )
                else:
                    print "Warning: Undefined Module: %s" % (inst.module_ref_name)


        for module in self.module_dict.values() :
            if module in module_ref_list :
                #  A referenced (instanciated) module, which are not
                # added to the root of the tree
                continue
            
            self.AddModule( self.root, module, module.name )
            
        
        # Expand the root?    
        self.Expand( self.root )
        
        # Select the first module and display the code for it
        first_module,cookie = self.GetFirstChild( self.root )
        self.SelectItem( first_module )
        self.UpdateHierInfo()
        
        print "Initialised Hier_Ctrl"
Ejemplo n.º 3
0
    def __init__(self, parent):

        #
        # Build and display the hierarchy treecontrol
        #
        gizmos.TreeListCtrl.__init__(self,
                                     parent,
                                     style=wx.TR_DEFAULT_STYLE
                                     | wx.TR_FULL_ROW_HIGHLIGHT
                                     | wx.TR_HIDE_ROOT)

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectModule)

        self.file_to_load = None
        self.cur_hier_path = ''
        self.cur_module_ref = None

        #
        # Read in a few verilog models that are hierarchical
        #
        if True:
            rtl_files = [
                'tests/rtl/trivial/top.v',
                'tests/rtl/trivial/a.v',
                'tests/rtl/trivial/b.v',
                'tests/rtl/trivial_clk_rstb/top_clk_rstb.v',
                'tests/rtl/trivial_clk_rstb/a_clk_rstb.v',
                'tests/rtl/trivial_clk_rstb/b_clk_rstb.v',
                'tests/rtl/spider/four_in_four_out.v',
                'tests/rtl/spider/one_in_one_out.v',
                'tests/rtl/spider/spider.v',
                'tests/rtl/spider/two_in_two_out.v',
                'tests/rtl/spider/one_in_two_out.v',
                'tests/rtl/spider/two_in_one_out.v',
                'tests/rtl/spider/spider_2.v',
                'tests/rtl/gates/and2.v',
                'tests/rtl/gates/inv.v',
                'tests/rtl/gates/gates1.v',
                'tests/rtl/gates/gates2.v',
                'tests/rtl/gates/gates3.v',
                "tests/rtl/snake/one_in_four_out.v",
                "tests/rtl/snake/snake_1.v",
                "tests/rtl/snake/three_in_one_out.v",
                "tests/rtl/snake/two_in_three_out.v",
                "tests/rtl/snake/two_in_two_out.v",
                "tests/rtl/snake/two_in_one_out.v",
                "tests/rtl/long_traces/long_1.v",
                "tests/rtl/long_traces/long_2.v",
                "tests/rtl/long_traces/one_in_three_out.v",
                "tests/rtl/feedback/feedback_1.v",
                "tests/rtl/feedback/feedback_2.v",
                "tests/rtl/feedback/feedback_3.v",
                "tests/rtl/feedback/three_in_three_out.v",
            ]
        else:
            rtl_files = [
                'tests/rtl/trivial/top.v',
                'tests/rtl/trivial/a.v',
                'tests/rtl/trivial/b.v',
                'tests/rtl/gates/and2.v',
                'tests/rtl/gates/inv.v',
                'tests/rtl/gates/gates1.v',
                'tests/rtl/gates/gates2.v',
                'tests/rtl/gates/gates3.v',
            ]

        myparser = hdl_parser()
        for rtl_file in rtl_files:
            myparser.build_cds_from_file(rtl_file)

        # Get the module dictionary
        self.module_dict = myparser.cds

        #
        # Image List stuff
        #
        image_size = (16, 16)
        image_list = wx.ImageList(image_size[0], image_size[1])
        self.green_id = image_list.Add(hier_tree_icons.getGreenBitmap())
        self.red_id = image_list.Add(hier_tree_icons.getRedBitmap())
        self.black_id = image_list.Add(hier_tree_icons.getBlackBitmap())
        self.blue_id = image_list.Add(hier_tree_icons.getBlueBitmap())

        self.SetImageList(image_list)
        self.image_list = image_list  # what's this for?

        # create some columns
        self.AddColumn("Hierarchy Tree")
        self.AddColumn("Module Name")
        self.SetMainColumn(0)  # the one with the tree in it...
        self.SetColumnWidth(0, 175)

        self.root = self.AddRoot("_top")
        self.SetItemText(self.root, "None", 1)
        self.SetItemImage(self.root,
                          self.green_id,
                          which=wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root,
                          self.blue_id,
                          which=wx.TreeItemIcon_Expanded)

        #
        # Now build the hierarchy
        #
        if not self.module_dict.values():
            print 'arrrrrgggghhhhh!!'

        #  Build a list of module names referenced in each of the
        # modules.  Any modules in the module list not in the referenced
        # module list are toplevel modules which need to be traversed
        module_ref_list = []
        for module in self.module_dict.values():
            for inst in module.inst_dict.values():

                # See if inst.module_ref_name string corresponds to an actual vv.Module
                if inst.module_ref_name in self.module_dict:
                    inst.module_ref = self.module_dict[inst.module_ref_name]
                    # Build the module list ref
                    module_ref_list.append(inst.module_ref)
                else:
                    print "Warning: Undefined Module: %s" % (
                        inst.module_ref_name)

        for module in self.module_dict.values():
            if module in module_ref_list:
                #  A referenced (instanciated) module, which are not
                # added to the root of the tree
                continue

            self.AddModule(self.root, module, module.name)

        # Expand the root?
        self.Expand(self.root)

        # Select the first module and display the code for it
        first_module, cookie = self.GetFirstChild(self.root)
        self.SelectItem(first_module)
        self.UpdateHierInfo()

        print "Initialised Hier_Ctrl"
Ejemplo n.º 4
0
    def __init__(self, parent):
    
        #
        # Build and display the hierarchy treecontrol
        #
        gizmos.TreeListCtrl.__init__(self, parent,
                                     style = wx.TR_DEFAULT_STYLE
                                            | wx.TR_FULL_ROW_HIGHLIGHT
                                            | wx.TR_HIDE_ROOT
                                     )

        self.Bind(wx.EVT_TREE_SEL_CHANGED, self.OnSelectModule)

        self.file_to_load   = None
        self.cur_hier_path  = ''
        self.cur_module_ref = ''
        
        #
        # Read in a few verilog models that are hierarchical
        #
        rtl_files = [
                     '../../tests/rtl/trivial/top.v',
                     '../../tests/rtl/trivial/a.v',
                     '../../tests/rtl/trivial/b.v'
                     ]

        myparser = hdl_parser()
        for rtl_file in rtl_files:
            myparser.build_cds_from_file( rtl_file )

        # Get the module dictionary
        self.module_dict = myparser.cds

            
        
        #
        # Image List stuff
        #
        image_size = (16,16)
        image_list = wx.ImageList(image_size[0], image_size[1])
        self.green_id  = image_list.Add( images_marty.getGreenBitmap() )
        self.red_id    = image_list.Add( images_marty.getRedBitmap()   )
        self.black_id  = image_list.Add( images_marty.getBlackBitmap() )
        self.blue_id   = image_list.Add( images_marty.getBlueBitmap()  )

        self.SetImageList(image_list)
        self.image_list = image_list  # what's this for?

        # create some columns
        self.AddColumn("Hierarchy Tree")
        self.AddColumn("Module Name")
        self.SetMainColumn(0) # the one with the tree in it...
        self.SetColumnWidth(0, 175)


        self.root = self.AddRoot("_top")
        self.SetItemText(self.root, "None", 1)
        self.SetItemImage(self.root, self.green_id, which = wx.TreeItemIcon_Normal)
        self.SetItemImage(self.root, self.blue_id, which = wx.TreeItemIcon_Expanded)


        
        #
        # Now build the hierarchy
        #
        if not self.module_dict.values():
            print 'arrrrrgggghhhhh!!'

        #  Build a list of module names referenced in each of the
        # modules.  Any modules in the module list not in the referenced
        # module list are toplevel modules which need to be traversed
        module_ref_list = []
        for module in self.module_dict.values():
            for inst in module.inst_dict.values():
                module_ref_list.append( inst.module_ref )
        

        # 
        for module in self.module_dict.values() :
            if module.name in module_ref_list :
                #  A referenced (instanciated) module, which are not
                # added to the root of the tree
                continue

            self.AddModule( self.root, module, module.name )
            
        
        # Expand the root?    
        self.Expand( self.root )
        

        # Select the first module and display the code for it
        first_module,cookie = self.GetFirstChild( self.root )
        self.SelectItem( first_module )
        self.UpdateHierInfo()