Creating HDL Text Modules, страница 39

          vhpiHandleT SigHdl = NULL; // handler

          if (ScopeHdl==NULL) return;

          if ( iteratorRegHdl = vhpi_iterator(vhpiInternalRegions, ScopeHdl) )

          //1.

          while ( Hdl = vhpi_scan(iteratorRegHdl) ){

                    //2.

                    vhpi_printf("%s [%d]: %s ",vhpi_get_str(vhpiKindStrP, Hdl),

                    vhpi_get(vhpiKindP, Hdl),

                    vhpi_get_str(vhpiNameP, Hdl) );

                    // signal declarations

                    if (iteratorSigHdl= vhpi_iterator(vhpiSigDecls, Hdl))

                    //3.

                    while ( SigHdl = vhpi_scan(iteratorSigHdl) ){

                              // handler points to object of type vhpiSignalDeclK (signal)

                              vhpi_printf("found signal: %s ", //signal name

                              vhpi_get_str(vhpiNameP, SigHdl));

                              (*numObjs)++;

                    }

                    traverse_hierarchy(Hdl, numObjs);

          }

}

9.9aCPP file contents

9.10Creating the Foreign Architecture

9.  VHPI applications can be registered by using foreign subprograms or foreign architectures. This tutorial shows how to register the VHPI application by using the foreign architecture.

Edit the dump_hierarchy_vhpi.vhd to include the code shown below:

-- Please put this declaration in architecture

entity dump_hierarchy is

end entity dump_hierarchy;

architecture dump_hierarchy of dump_hierarchy is

attribute foreign of dump_hierarchy : architecture is

"VHPI VHPI\vhpiuser_aldec.dll; dump_hierarchy_model";

begin

end architecture dump_hierarchy;

After editing, check if the new code compiles cleanly.

9.11 Instantiating the Foreign Architecture

10.The dump_hierarchy architecture created on the previous slide has to be instantiated in the top-level unit. The neighboring pictures show component declaration and instantiation in the testbench.vhd file.

9.12 C/C++ Configuration

11.Double click on the C/C++ Configuration file $DSN/VHPI/datapath.dlm. The C/C++ configuration dialog allows to specify all options required to build the VHPI application. Verify that the settings are the same as shown in the picture below.

11.Double click on the C/C++ Configuration file $DSN/VHPI/datapath.dlm. The C/C++ configuration dialog allows to specify all options required to build the VHPI application. Verify that the settings are the same as shown in the picture below.

9.13 C/C++ Compilation

12. Click dump_hierarchy.dlm with the right mouse button and choose Build      from the context menu. The VHPI library (vhpiuser_aldec.dll) will be built.

9.14 Running the Simulation

13. Recompile HDL files. (Two files were edited during previous tutorial steps.)

14. Choose Initialize Simulation from the Simulation menu. The VHPI application will be registered through the VHDL foreign architecture. This is reported to the Console window

# KERNEL: PLI/VHPI kernel's engine initialization done.

# VHPI: Loading library 'VHPI\vhpiuser_aldec.dll'

                    The VHPI application starts analyzing the design and prints collected information to the Console window.

# : Using VHPI application as Foreign Architecture to count declared signals

# : found signal: CLK

# : found signal: RESET

# : found signal: START

# : found signal: CODE

# : found signal: DATA_IN

...

                    When the scan is complete, the design is ready for simulation.

Active-HDL Interfaces

Debugging C Code

Course 10

10. C Debug Tools in Active-HDL

                    C applications connected to the simulator via the VHPI or PLI interface can be debugged inside Active- HDL environment. Active-HDL includes tools required for C debug:  

•  C/C++ debugger (gdb)

•  Graphical front-end for gdb

                    The gdb debugger is part of the MinGW (Minimalist GNU for Windows). MinGW tools are installed into MinGW\bin directory.

10.1 Tutorial Overview