Question

I compiled a large VHDL design in ModelSim successfully. The design is not important here, my question is about ModelSim commands for any VHDL design.

Now let's say I have an entity E1 there and I want to know all the packages and entities that are being used/instantiated by E1. I want to use this command in a Tcl procedure like this

proc get_dependency_list_of_entity { E1 } {
 ...
}

In other words: How can I extract all dependencies of a vhdl module with a ModelSim command.

My approach is this: The command write report -tcl returns enough information to extract the library of E1, say L1.

Now the command vdir -lib L1 returns all the entities and packages that are compiled in L1. But of course these are too much. It lists also packages that are in no way related to E1.

So is there a way to get the dependent modules of a vhdl module with a ModelSim command?

Était-ce utile?

La solution

I finally found a solution.

the command vdir -lib $lib -prop dpnd $entity returns you something like this:

 data: ENTITY E1
#     Depends on: P ieee std_logic_unsigned RYmj:=TK`k=k>D@Cz`zoB3
#     Depends on: P ieee std_logic_arith 4`Y?g_lldn;7UL9IiJck01
#     Depends on: P std textio 5>J:;AW>W1[[dW0I6EN1Q0
#     Depends on: P ieee std_logic_1164 5=aWaoGZSMWIct0i^f`XF1
#   ARCHITECTURE BODY rtl
#     Depends on: E L2 E2 3B3>6RbjY07ohgTgj<M4r0
#     Depends on: E L3 E3 5?a[d8Ikz7>zWX`U97gNE2
#     Depends on: P ieee std_logic_unsigned RYMj;=TK`k=k>C@Cz`zoB3
#     Depends on: P ieee std_logic_arith 7`F?g_lkdn;7UL9IiJck01
#     Depends on: P std textio 5>J:;AW>w0[[dW0I6EN1Q0
#     Depends on: P ieee std_logic_1164 5=aWboGZSMlIcH0i^f`XF1
#     Depends on: E work E1 ;4e7E?eQ@DHPeB>5WUDQK3 

P stands for package and E for Entity. So you can use regular expressions (like me in the extracting function) to extract the data you want.

    proc get_dependency_list_of_entity { lib entity } {

        set vdir_data [ vdir -lib $lib -prop dpnd $entity ]

            set match [extracting $vdir_data "^ *Depends on: (.+)"]
            ...
        }
        ...
     }

As I mentioned already in the question: There are ways to get the library of an entity with vdir and also with write report -tcl

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top