FAQ

Frequently Asked Questions

Where do I find a viewer for the VCD files?

You can use the WinWave viewer (<installdir>\gtkwave\winwave.exe) to see the value change dump files.

Where do I find documentation about SystemC?

If you are looking for a document on how to use SystemC with borland C++Builer you should look in the directory '<installdir>\SystemC2.0.1borland\docs'. For more information on SystemC and a User Manual look at http://www.systemc.org/.

Borland error "Ambiguity between ..."

Borland does not know how to treat a particular variable (e.g. as a int, unsigned int, long ...). Use type casting to make it clear.
E.g. ambiguity error in file sc_signal_rv.h at line 88, which is
for( int i = sz - 1; i > 0 && res != 3; --i )
means that the compiler does not know whether to treat variable res as sc_logic and use sc_logic operator !=, or convert it to integer and use integer !=. Clarify it by casting res to integer.
for( int i = sz - 1; i > 0 && (int)res != 3; --i )

Exception message running the SystemC model in C++Builder.

One of the possible causes of an exception may be the incorrect compilation options. To solve this problem you should do the following: Quit from Borland. Open the '.bpr' file of the project you experience this problem with in notepad. Go to the "CFLAGS1" line and remove the "-b-", "-Vx" and "-Ve" flags and insert the "-b" (without the postfix minus) flag. Then, launch Borland and rebuild the project [Project | Build 'projectname'] before running [Run | Run].

The other reason for an apparent crash may be an exception raised by SystemC simulation. When SystemC library encounters some error in the simulation, it raises an exception, which is intercepted by Borland environment.
To see the cause of the exception, run the simulation from the Cygwin or DOS shell, e.g.

$ ./mips.exe 
Then, the interception mechanism is switched off and the cause of the exception is displayed.

The most common error is 'Port not bound'. This means that a port of one of the modules is not connected to any signal. The message is accompanied by the specification of the unbound port, e.g. mips.hazard.port_5 (sc_out). This means that the 6th port (ports are numbered starting from 0) of the module hazard, submodule of mips is not connected. This port is an output of the module (sc_out).
Since the ports are numbered in the order of their declaration in the header file, you can open the file where the 'hazard' module is defined , e.g. hazard.h find the 6th declared port and see why it's not connected to any signal.

First instruction of the program is not executed

Because of the program counter bypass necessary to accomodate synchronous memory, the program starts from instruction at address 4, instead of 0. Since the instruction memory address is taken directly from mux1, when PC is reset to 0, mux1 'immediately' becomes 4 and at the next rising clock edge memory 'sees' address 4 for the first instruction.

Workaround:

Always put NOP as the first instruction of your program.

mMIPS program seems to run over and over again (overwrites previous results)

You have to remember that there is no "STOP" instruction in mMIPS, so as long as there is a clock signal and enable signal, next value of program counter will be computed and the next instruction will be fetched and executed. Since only least significant 10 bits of the PC are used to address instruction memory, it means that after PC reaches address 1024 (after 256 instructions), it starts executing program from the beginning.

To 'stop' the program you need to introduce an infinite loop to your code:

in C :

while(1);

in assembler :

END: beq $0,$0,END
nop

Adding modules to the mMIPS project

When you add a definition of a new module to the mMIPS, you need to add the information about the file with the definition of the module to the project, so that it is appropriately compiled and linked
Let's assume you created a module FORWARD in files forward.h and forward.cpp. You add the forward.cpp file to Borland project in the usual manner, from within the Borland environment.
The second required step is to add the file to the CoCentric project, so that forward.cpp (with the included forward.h) is compiled into FORWARD.v Verilog module.
To do that you need to edit cocentric.scr file (CoCentric project file). For each added .cpp file add the following lines to the cocentric.scr file:
echo
echo --- File <insert filename here>.cpp
echo
compile_systemc -rtl -cpp_options " -I. -DBRAM -DBROM -DBREG -DSPYING \
-DVERILOG" -rtl_format Verilog <insert filename here>.cpp
if( dc_shell_status == 0 ) { exit 1; } else { echo OK; }

To add a module in SystemC code, remember that each module is created in three phases:

  1. declaration :
    FORWARD *forward;
  2. creation :
    forward = new FORWARD("forward");
  3. connections :
    forward->port1(signal1);
    forward->port2(signal2);

When I try to run or debug a project I get the error message "Debugger kernel BORDBK51.DLL is missing or not registered". How do I solve this problem?

You find the answer at the Borland Developer Network. (answer)

Last updated: Thu, 6 May 2004 09:10:22 +0200