Skip to content

Simulates and displays the internal functioning of the Mano Computer's CPU.

License

Notifications You must be signed in to change notification settings

fallazc/Mano-Computer-Simulator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Mano-Computer-Simulator

An application developed as part of my computer architecture class to model a 16-bit CPU down to its registers and the way it processes instructions and data.

Design patterns

  ❖ Model View Presenter (MVP)

  ❖ Delegation

Model View Presenter

  Model → Defines the data to be displayed.

  View → Displays the data and routes events to the presenter.

  Presenter → Acts upon the model and the view.

Delegation

Using Java 8’s lambda expressions:

interface StringFunc {
  String func(String s);                                            
}                                                                  
                                                                
void doSomething(StringFunc funk) {                               
  System.out.println(funk.func("whatever"));                      
}                                                                 
                                                                  
doSomething((t) -> t + "asd");                                      
doSomething((t) -> new StringBuilder(t).reverse().toString());   

Using function pointers in c++:

int doubleIt(int d) { 
  return d * 2;
}

int halveIt(int d) { 
return d / 2;
 }
 
typedef int (*MyFuncT) (int d);

MyFuncT fp = &doubleIt;
cout << fp(3);

fp = &halveIt;
cout << fp(3);

Before all the steps

initial-state

Execution flow

execution-flow

After all the steps

execution-result

Note: This program was created using Qt Creator so you will either need to install it and import the project file or setup your build system's dependecies accordingly