GithubHelp home page GithubHelp logo

tomasulo-simulator's Introduction

Tomasulo simulator

This is a project for the Advanced Computer Architectures course of Politecnico di Milano. It simulates the Tomasulo algorithm which is used in CPUs to improve throughput while avoiding hazards. It was implemented following the course slides and also this document, but changes were made where appropriate for simplicity.

How to run

This project requires python 3.6+

Virtualenv (optional)

I highly suggest creating a virtualenv in order to keep your system clean. You can do it in many ways, my preferred is using virtualenvwrapper. Follow this guide to install it, then create and activate the virtualenv with

mkvirtualenv tomasulo-simulator
workon tomasulo-simulator

You can exit the virtualenv with deactivate, and delete the virtualenv with rmvirtualenv tomasulo-simulator

Installing required libraries

pip install -r requirements.txt

Running

usage: simulation.py [-h] [--output OUTPUT] [--no-stats] [--interactive]
                     [--step-by-step] [--dump-assembled-instructions]
                     [--quiet]
                     program

Tomasulo algorithm simulator

positional arguments:
  program               the assembly file to execute

optional arguments:
  -h, --help            show this help message and exit
  --output OUTPUT, -o OUTPUT
                        Output statistics to json
  --no-stats, -n        Don't output statistics on STDOUT
  --interactive, -i     Spawn IPython shell during the simulation
  --step-by-step, -s    Execute the simulation step by step
  --dump-assembled-instructions, -d
                        Print the assembled instructions
  --quiet, -q           Don't print the program logo

See the examples directory for examples on how to write assembly for the machine.

TODO

  • document everything
  • (maybe) move the execution of instructions to the functional units instead of the reservation stations
    • timings should not change, but it would better represent a real CPU
  • implement reorder buffer
  • implement speculation (issue-wise and execution-wise)
  • write tests and a way to run them
  • implement NOT instruction
  • finish implementing floating point instructions
  • indirect jumps (e.g. JMP R1)
  • allow load/stores like LD R1, [R2]

tomasulo-simulator's People

Contributors

fcremo avatar

Watchers

 avatar  avatar

tomasulo-simulator's Issues

Problem running the simulator

Traceback (most recent call last): File ".\simulation.py", line 5, in <module> import IPython File "C:\Users\Ta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\IPython\__init__.py", line 55, in <module> from .terminal.embed import embed File "C:\Users\T\AppData\Local\Programs\Python\Python38-32\lib\site-packages\IPython\terminal\embed.py", line 17, in <module> from IPython.terminal.ipapp import load_default_config File "C:\Users\T\AppData\Local\Programs\Python\Python38-32\lib\site-packages\IPython\terminal\ipapp.py", line 28, in <module> from IPython.core.magics import ( File "C:\Users\Tn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\IPython\core\magics\__init__.py", line 21, in <module> from .execution import ExecutionMagics File "C:\Users\Tn\AppData\Local\Programs\Python\Python38-32\lib\site-packages\IPython\core\magics\execution.py", line 45, in <module> from IPython.utils.timing import clock, clock2 File "C:\Users\Ta\AppData\Local\Programs\Python\Python38-32\lib\site-packages\IPython\utils\timing.py", line 62, in <module> clocku = clocks = clock = time.clock AttributeError: module 'time' has no attribute 'clock'

This is because he function time.clock() has been removed, after having been deprecated since Python 3.3:
use time.perf_counter() or time.process_time()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.