gem5: Introduction

gem5 is an open-source computer architecture simulator. It provides a framework for modeling and simulating various aspects of computer systems, including processors, memory hierarchies, interconnects, and peripheral devices. gem5 allows researchers, developers, and computer architects to evaluate the performance and behavior of different hardware designs, system configurations, and software workloads.

The objective of this blog series is to provide a helpful introduction to working with gem5, complementing its official documentation and tutorial.

Installing SystemC

For installing SystemC on a Linux computer (Ubuntu / Pop!_OS 22.04), first install the Core SystemC Language and Examples from the Accellera website or the SystemC community portal.

sudo apt-get install build-essential
tar -xvf systemc-2.3.3.tar.gz
cd systemc-2.3.3/objdir
sudo mkdir /usr/local/systemc-2.3.3
sudo ../configure --prefix=/usr/local/systemc-2.3.3/
sudo make
sudo make install
export SYSTEMC_HOME=/usr/local/systemc-2.3.3/

For compiling with SystemC:

g++ -I. -I$SYSTEMC_HOME/include -L. -L$SYSTEMC_HOME/lib-linux64 -Wl,-rpath=$SYSTEMC_HOME/lib-linux64 -o hello hello.cpp -lsystemc -lm

Repair bootloader

In the case that Windows removed the boot entry of your Linux OS, follow these steps.

If your disk is encrypted, decrypt and mount the disk with

sudo cryptsetup luksOpen /dev/sda3 cryptdata
sudo mount /dev/mapper/data-root /mnt

Otherwise, mount your unencrypted disk with

sudo mount /dev/sda3 /mnt

Then, mount the EFI system partition

sudo mount /dev/sda1 /mnt/boot/efi

Continue with

for i in dev dev/pts proc sys run; do sudo mount -B /$i /mnt/$i; done
sudo chroot /mnt
apt install --reinstall linux-image-generic linux-headers-generic
update-initramfs -c -k all
exit
sudo bootctl --path=/mnt/boot/efi install