1) Make sure you have all the software requirements satisfied. In this tutorial, we use:
You will also need to install other packages depending on which tool you are planning to use, explained below. We assume you reserve a folder called "quickstart-archc" to ease the package organization:
$ mkdir quickstart-archc $ cd quickstart-archc
2) Get the SystemC library:
The interpreted simulators requires the software SystemC to be installed. Please download it from www.systemc.org . Download -> Accellera Standards -> SystemC -> systemc-2.3.1.tgz. After downloading it, you can install the package.
$ tar -xvf systemc-2.3.1.tgz $ cd systemc-2.3.1 $ ./configure --prefix=$(pwd)/../systemcinstall $ make $ make install $ cd ..
1) Get the latest ArchC language and tools. We assume ArchC 2.4.1 here.
2) Install ArchC into a directory of your choice. Here we assume "quickstart-archc/acinstall". Nevertheless, we provide here the full configure command for reference.
$ tar -xvf ArchC-2.4.1.tar.gz $ cd ArchC-2.4.1 $ ./autogen.sh $ INSTALLDIR=$(pwd)/../acinstall # Set installdir to the parent folder, subfolder install $ SYSTEMCPATH=$(pwd)/../systemcinstall # Where we previously installed SystemC $ ./configure --prefix=$INSTALLDIR --with-systemc=$SYSTEMCPATH $ make $ make install $ source env.sh # Configure your PATH environment $ cd .. # Return to prev dir $ acsim -h # Check if it works
In this example, a MIPS ISS (Instruction-Set Simulator) will be generated by ArchC using a high-level description model.
1) Get the ArchC MIPS model from github or from ArchC Download page.
$ mkdir -p processors/mips $ cd processors/mips $ wget https://github.com/ArchC/mips/archive/v2.4.0.tar.gz $ tar -xvf mips-2.4.0.tar.gz
2) Create an interpreted simulator
$ cd mips-2.4.0 $ acsim mips.ac -abi $ make $ cd ..
3) Get the Mibench Benchmark package compiled for MIPS to be simulated on ISS. In this example we will calculate the SHA hash of a file.
$ wget http://archc.lsc.ic.unicamp.br/downloads/Bench/MipsMibench.tar.bz2 $ tar -xvf MipsMibench.tar.bz2
4) Run the SHA program from the Mibench MIPS package you just downloaded, using your new simulator:
$ mips-2.4.0/mips.x -- MipsMibench/security/sha/sha MipsMibench/security/sha/input_small.asc $ cd mibench/security/sha/bin
The output should be
320c22e9 7b1ed440 77d2e55a bbe2481a 2b24a55b, informing you
the SHA digest for the input ASCII file.
1) If you want to see exactly which MIPS instructions the simulator is executing, uncomment the line
//#define DEBUG_MODEL in mips_isa.cpp file inside mips-2.4.0 folder, then recompile the model:
$ make clean $ make
And execute again the examples above. Prepare to receive a very large amount of information, since these examples typically execute millions of instructions.
2) If you want extra statistics about instructions types usage, you need to
generate the simulator with the
$ make distclean # to clean the whole model $ acsim mips.ac -abi --stats $ make
Be careful with the
distclean rule. If you changed the
main.cpp file (which
you will change if you are playing with the SystemC model and the components
of the platform or working with TLM),
distclean will wipe out your