Difference between revisions of "How to get module ports from Verilog parsetree"

From Verific Design Automation FAQ
Jump to: navigation, search
(Created page with "From the Verilog parsetree, how can I get the ports of a module? You can use the following APIs: VeriModule::GetPorts() to get the ports (Array of VeriIdDef *) from a module...")
 
m
 
(2 intermediate revisions by the same user not shown)
Line 1: Line 1:
From the Verilog parsetree, how can I get the ports of a module?
+
'''Q: From the Verilog parsetree, how can I get the ports of a module?'''
  
 
You can use the following APIs:
 
You can use the following APIs:
  
VeriModule::GetPorts() to get the ports (Array of VeriIdDef *) from a module.
+
* VeriModule::GetPorts() to get the ports (Array of VeriIdDef *) from a module.
VeriIdDef::IsInterfacePort() to check if it is an interface port.
+
* VeriIdDef::IsInput()/IsOutput()/IsInout() to get the port direction
VeriDataType::GetEnums(). If it returns non-NULL, the data type is enum.
+
* VeriIdDef::GetDimensions() to check if it's an array of ports (returning 0 for a single port)
VeriDataType::IsTypeRef() returns 1 for user defined data types.
+
* VeriIdDef::IsInterfacePort() to check if it is an interface port.
 +
* VeriDataType::GetEnums(). If it returns non-NULL, the data type is enum.
 +
* VeriDataType::IsTypeRef() returns 1 for user defined data types.

Latest revision as of 15:46, 22 July 2016

Q: From the Verilog parsetree, how can I get the ports of a module?

You can use the following APIs:

  • VeriModule::GetPorts() to get the ports (Array of VeriIdDef *) from a module.
  • VeriIdDef::IsInput()/IsOutput()/IsInout() to get the port direction
  • VeriIdDef::GetDimensions() to check if it's an array of ports (returning 0 for a single port)
  • VeriIdDef::IsInterfacePort() to check if it is an interface port.
  • VeriDataType::GetEnums(). If it returns non-NULL, the data type is enum.
  • VeriDataType::IsTypeRef() returns 1 for user defined data types.