224
Development Tools User’s Guide
Intel® IXP2400/IXP2800 Network Processors
Foreign Model Simulation Extensions
DLL. The foreign_model_main.cpp file provides the data structures and functions (including
XACT_Proxy_Initialize) needed to dynamically bind your Foreign Model DLL to any Transactor
that loads it using the “foreign_model” command.
7.5.1
DLL Sample Code
.
/* ForeignModelDLL.cpp
This file contains sample code demonstrating how to create a dynamic-link
library (DLL) for a simulation extension to be used in conjunction with the
transactor DLL. A foreign model DLL is activated using the 'foreign_model'
transactor command. The Workbench automatically executes this command for you
if you specify the foreign model through the Workbench GUI. To do this select
Options from the Simulation menu then select the Foreign Model tab. In your DLL
you must provide the exported function GetVmodForeignModelFunctions(), which
the transactor calls to get the addresses of the six functions that the
transactor calls to interact with your foreign model.
In your foreign model code you can access any of the transactor API functions
that are defined in xact_vmod.h. To do this, you must include xact_vmod.h in
your source files and you must link against IXP2800.lib or IXP2400.lib,
depending on which chip type you will be simulating.
*
* ---------------------------------------------------------------------
*
* I N T E L P R O P R I E T A R Y
*
* COPYRIGHT (c) 1998-2002 BY INTEL CORPORATION. ALL RIGHTS
* RESERVED. NO PART OF THIS PROGRAM OR PUBLICATION MAY
* BE REPRODUCED, TRANSMITTED, TRANSCRIBED, STORED IN A
* RETRIEVAL SYSTEM, OR TRANSLATED INTO ANY LANGUAGE OR COMPUTER
* LANGUAGE IN ANY FORM OR BY ANY MEANS, ELECTRONIC, MECHANICAL,
* MAGNETIC, OPTICAL, CHEMICAL, MANUAL, OR OTHERWISE, WITHOUT
* THE PRIOR WRITTEN PERMISSION OF :
*
* INTEL CORPORATION
*
* 2200 MISSION COLLEGE BLVD
*
* SANTA CLARA, CALIFORNIA 95052-8119
*
* ---------------------------------------------------------------------
*
*/
// You must include xact_vmod.h in order to link correctly against
// the DLL version of the transactor.
//
#include "xact_vmod.h"
#include <stdlib.h>
#include <string.h>
// for testing purposes only
// remember the init_str from the foreign_model_initialize so it can be used