Skip to content

This project aims to implement the abstract computational Random Access Machine in Java.

License

Notifications You must be signed in to change notification settings

angeligareta/random-access-machine

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

58 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Random Access Machine

Implementation of a Random Access Machine in Java programming language.

ULL License

Summary

This project aims to implement a Random Access Machine. The Random Access Machine is an abstract computational-machine identical to the counter machine but adding the indirect addressing. The machine has a Program Memory, Data Memory, Input Tape and OutputTape objects to execute a program. Besides it uses the ArithmeticLogicUnit to do all the calculation. The code documentation can be found here.

UML Diagram

Here there is an UML Class diagram representing how the project is structured: UML Class Diagram

Structure

The classes are divided in:

  • ArithmeticLogicUnit: abstract class that represents the Arithmetic Logic Unit of the Random Access Machine. It has all the necessary methods to assign, add, subtract, multiply and divide registers with another registers or with constants.
  • DataMemory: contains an array of the Data Register that the Random Access Machine will use.
  • DataRegister: subclass of Register with the Integer data type. Besides it implements a method to change the data of the register.
  • InfiniteMemory: abstract class that simulates an infinite TreeMap. The subclasses of InfiniteMemory must implement a getter and a setter of that TreeMap.
  • InputTape: does all the necessary operations with the inputTape. This includes creating the buffer, reading from it and closing it.
  • InstructionType: enum for all the instructions that our ram machine can have.
  • Operating: enum for all the operating that our ram machine can have.
  • OutputTape: does all the necessary operations with the outputTape. This includes creating the buffer, writing in it and closing it.
  • ProgramMemory: contains the Hash of lines-instruction that represents the program the machine is running.
  • ProgramRegister: contains the instruction in a register.
  • RandomAccessMachine: abstract computational-machine identical to the counter machine but adding the indirect addressing. The machine has a Program Memory, Data Memory, Input Tape and OutputTape objects to execute a program. Besides it uses the ArithmeticLogicUnit to do all the calculation.
  • Register: abstract class that represents a generic type of register and contains a data and a method to read it.
  • StartRandomAccessMachine: starts a Random AccessMachine depending on the arguments passed to main method.

Author

About

This project aims to implement the abstract computational Random Access Machine in Java.

Topics

Resources

License

Stars

Watchers

Forks

Languages