Center for Communications and Digital Signal Processing (CCDSP)


CCSP Silicon DSP Corporation CCSP Tech Blog

Getting Started 64 bit MSYS2

Capsim 64 Bit MSYS2 Announcement

CapsimTMK Installation and User Guides

1. Getting Started

You can run CapsimTMK from the BIN directory, BIN/MSYS2/capsim.
Each platform has a sub directory.
Example topologies are included in the APPLICATIONS directory.
Each application has a README file.

Define the environment variable CAPSIM to point to the directory where CapsimTMK resides.
For example if you place CapsimTMK in the directory:


/usr/local/CapsimTMK


Then define $CAPSIM as:


export CAPSIM=/usr/local/CapsimTMK

To start capsim in the interactive mode type:

winpty $CAPSIM/BIN/MSYS2/capsim -b

 

for TCL support :

winpty $CAPSIM/BIN/MSYS2/capsim -c

See the Capsim Text Mode User Guide for a tutorial.

On MSYS2 always prefix with winpty:
winpty $CAPSIM/BIN/MSYS2/capsim -c

2. Creating Capsim and Adding Models

CAPSIM provides the utility to add blocks to the library through
the use of the bash shell program precapsim_msys2.sh.
This is a separate program from CAPSIM and is run from the UNIX/LINUX shell
not from inside CAPSIM. Another program, blockmaint.pl, is also available
for library maintenance.

See the file README.txt

3. Precapsim and Makefile

The bash shell script precapsim_msys2.sh provides all the functionality necessary
to create your own personalized version of CAPSIM.

Create a new directory any where on your system. For example WORK.
You will be creating blocks and subroutines to incorporate into Capsim
in this directory.

Suppose that CapsimTMK is installed in the following directory:

/usr/local/CapsimTMK

Then setup the environment variable CAPSIM as follows:

export CAPSIM=/usr/local/CapsimTMK

Next make the directory you just created (e.g. WORK) the current directory
and execute the following:

 

On MSYS2 use:
%bash $CAPSIM/TOOLS/precapsim_msys2.sh -l




The precapsim_msys2.sh shell command will create all the necessary directories and copy all files
including Makefiles and scripts from the $CAPSIM directory.
It will also create the capsim executable in the current directory.

You may need to type
make
after running the precapsim_msys2.sh shell command.

To execute capsim type:

winpty ./capsim -c

 

You will be in the Capsim TMK interactive environment. Go ahead and quit.

4. Directory Structure

The shell command creates the directories BLOCKS, SUBS, and include.
A dummy subroutine and block are also created.

A key point is that the precapsim_msys2.sh also copies a Makefile in
the current directory.

With this Makefile it is very easy to build capsim using your blocks
and subroutines.
All you need to do is modifgy a block in the BLOCKS directory and, in the main directory (WORK), type make.

 

When you add a blockto the BLOCKS directory type:

bash $CAPSIM/TOOLS/precapsim_msys2.sh

 

View the Makefile to see how this happens. The BLOCKS directory has
a file called blocks.mak .
This makefile has all the necessary dependencies to create the C code from the Block ".s" code.
It adds the block to the blockmaint database blockdatabase.dat
and creates the file krn_blocklib.c
and the library libblock.a with the object files for the blocks.
This is all done automatically.

The file blocks.mak itself is created by a perl script blockmake.pl in the $CAPSIM/TOOLS directory.
This perl script, given the name of the blocks or *.s, creates a Makefile
for the blocks: blocks.mak.

For more info on the block database and blockmaint see the CapsimTMK
document on adding blocks (Capsim Customization).

The subroutine directory SUBS also has a Makefile and any C subroutine
will be compiled and added to the libsubs.a library and linked to capsim.

The include directory is where common include files to the blocks in
the BLOCKS and C code in the SUBS directory should be placed.
The Makefiles use this directory to search for include files when compiling
the blocks and subroutines.

So in a nutshell it is real easy to get started.
For the first time just execute bash $CAPSIM/TOOLS/precapsim.sh .
Afterwords just type make to update.
Just place blocks in the BLOCKS directory and the subroutine C code
in the SUBS directory.

If you add a new block run:
bash $CAPSIM/TOOLS/precapsim_msys2.sh

When running make, check for errors for each step and correct them.

For block compile errors, refer to the C code. Make sure you fix the
corresponding .s code.

You can use gdb and ddd to debug the block source code.

5. Using TK/TCL Scripts or Java for Creating Custom Blocks and Block Management

Note we have developed a Java Open Source Application called BlockBuilder.jar.
This is more platfrom friendly than TCL/TK and should be used.
See the TOOLS directory.

Run it with:
java -jar $CAPSIM/TOOLS/BlockBuilder.jar
Then run
perl $CAPSIM/TOOLS/blockgen.pl

For TCL/TK:

The easy way to create your own block is to run the blockgen.tcl script.
Change directory to your Working directory's BLOCKS directory.
Make sure you set the CAPSIM environment variable to point to where
CapsimTMK is located.

Type the following:

wish $CAPSIM/TOOLS/blockgen.tcl

Two windows will appear. In one window you can select the Block Type and
Buffer type. In the second window you can add parameters before you generate the XML code for the block.

After the block is generated, you can modify the code and add your own
C code.

To manipulate and view the block database, use the blocksmanage.tcl script.

Run this script in your BLOCKS directory.

wish $CAPSIM/TOOLS/blocksmanage.tcl

You can use this tool to view the generated C code and the XML code for blocks. Also add and delete blocks from the block database file:
blockdatabase.dat

You can also generate HTML documentation for your block with this tool.


© 2007-2017 Silicon DSP Corporation