Skip to content

Small wrapper of riscv ufficial project of PoliTo course 'Architetture dei sistemi di elaborazione'

Notifications You must be signed in to change notification settings

AleBera03/ase_handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Architetture dei sistemi di elaborazione | PoliTo: ase_handler wrapper of ase_riscv_gem5_sim

This wrapper includes several commands that enhance the experience of using ase_riscv_gem5_sim. Here the using overall flow from zero:

  1. Use https
git clone https://github.com/AleBera03/ase_handler
  1. Check permission of rep with
ls -la "../path/to/ase_handler"
  1. Give permission recursively if there are not execution perms
sudo chmod -R +x "path/to/ase_handler"
  1. Move in the rep folder
cd "path/to/ase_handler"
  1. Execute setup.sh script using same shell of the caller
. ./setup.sh

or

source ./setup.sh

The above script:

in this way

father_dir
    |-- ase_handler
    |-- ase_riscv_gem5_sim
    |-- konata-linux-x64
    |-- other ...

NB: If in your system ase_riscv_gem5_sim and/or konata-linux-x64 is already installed, then clone ase_handler in this way too

father_dir
    |-- ase_handler     # clone here
    |-- ase_riscv_gem5_sim
    |-- konata-linux-x64
    |-- other ...

NB: The project is only tested for Ubuntu-22.04 distro (same version of VM proposed during the course)

Manual setup of environment

In contrast, if you want to manually setup (rather than launching setup.sh, e.g. when you have already installed ase_riscv_gem5_sim and Konata) the flow is simple:

  1. write at the bottom of ~/.bashrc file, as in this example
export PATH="/home/ale_bera/ase_handler:$PATH"      # add dir of ase_handler rep to PATH
ASEMANAGEPROGRAM="/home/ale_bera/ase_handler"       # dir of ase_handler rep
export ASEMANAGEPROGRAM
ASEDIR="/home/ale_bera/ase_riscv_gem5_sim"          # dir of ase_riscv_gem5_sim rep
export ASEDIR
# konata env
KONATADIR="/home/ale_bera/konata-linux-x64"
export KONATADIR
export PATH="/home/ale_bera/konata-linux-x64:$PATH"

NB: At this point the folder scheme as above is not more mandatory. It is sufficent to properly set every directories you want

  1. update changes
source ~/.bashrc
  1. remember to install/upgrade py libraries

Why ?

The goal of this project is to avoid manual and repetitive cli operations throught folders. Hence, I implemented three very simple command capable to handle the source code even outside the ufficial project folder.

How ?

The setup.sh properly export the env variable, so you can run commands wherever

Tip: A combination of ase_sim and ase_rem should be sufficent

NB: The simulation run in interactive mode every time, unless you run ase_sim with -a | --add <file> option. Read here.

ase_add

Create the proper folder within ufficial project respecting Makefile format and creating an hard link inside 1 Type everywhere

ase_add ex.s

to produce this

ase_riscv_gem5_sim
    |-- programs
        |-- ex
            |-- Makefile    # ASM = ./ex.s
            |-- linked.ld
            |-- ex.s
        |-- other_programs ...
    |-- other ...
VD_aseadd.mp4

ase_rem

Fistly list the remaining programs in the ufficial project. Then, it is possible to choose one of them to delete

VD_aserem.mp4

With -a | --all option it is possible delete every file and subdir of both

ase_riscv_gem5_sim
    |-- programs
        XXXX
    |-- results
        XXXX
    |-- other ...

ase_sim

Start the simulation launching simulate.sh (-h | --help for more details). It is possible to modify the latencies. In addition, in order to speed the workflow, the option -a | --add <file> automatically add the program in the proper folder if there is not yet and then it run it (without choosing option).

NB: it is possible to use -a | --add <file> even when program already exists, e.g. if one wants to simulate a certain program

VD_asesim_lt.mp4

Finally, a .xlsx file is generated by generate_pipeline_table.py for default in the working directory (so where you call ase_sim). For example, after

ale_bera@linux-desktop:~$ ase_sim

will move excel file within /home/ale_bera Instead, if you typed -i | --in option with a selected folder the excel file will be moved to that folder. For example

ale_bera@linux-desktop:~$ ase_sim -i ./tmp

to

/home/ale_bera
    |-- tmp
        |-- ex.xlsx
        |-- ex.dump
        |-- stats_ex.txt
        |-- trace.out       # or gem5_inorder.log
    |-- ...

NB: notice that with -i | --in option even other result files will be moved within typed folder

ONLY FOR WSL2 USERS: With the option -t | --table the excel file is moved to the following windows folder

C:\%USERPROFILE%\Documents
Vd.Asesim.T.mp4

Set Out Of Order Architecture

Following ase_riscv_gem5_sim documentation, in order to setup OoO architecture it is enough modify setup_default file within ase_riscv_gem5_sim folder. With -o | --out option will compare a example set of possibilies BPUs from create_predictor.py. Usage:

ase_sim -o [OPTIONS]
1) LocalBP
2) TournamentBP
3) BiModeBP
Choose a BP: 

Right now, for further configuration modify ase_riscv_gem5_sim/gem5/create_predictor.py

NB: this option is avaible only after 5/11/2025 commit

generate_pipeline_table.py

This python script is able to generate a well formatted excel file on which easily build the pipeline by hand.
Required libraries:

  • pandas
  • openpyxl

The setup.sh file already installs or upgrades above packages executing theese lines

python3 -m pip install --upgrade pip setuptools wheel
python3 -m pip install --upgrade pandas
python3 -m pip install --upgrade openpyxl

Footnotes

  1. The role of hard link is to sync changes from original file towards the one within ufficial project

About

Small wrapper of riscv ufficial project of PoliTo course 'Architetture dei sistemi di elaborazione'

Topics

Resources

Stars

Watchers

Forks