Skip to content

maanas-talwar/PyWash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyWash

Two Pass Assembler for a Washing Machine System

Description

Washing machine is a simple system whose operations can be emulated through software. The assembler assumes that the operations happening on the hardware level are implemented in the system itself. The assembler only converts the assembly level program to a binary output.

  • The washing machine is a simple device consisting of two basic operations - WASH and DRY.
  • All the instructions, sub-routines and operations are a part of the machine that facilitate the two basic operations.
  • The system consists of a timer to control how long a task is executed, temperature control to decide the temperature during the wash cycle, spin speed and wash type control to decide machine's current state i.e. washing state or drying state.
  • The timer, temperature control, spin speed and wash type control are all controlled by sub-routines which implement the above descirbed operations utilizing some reserved memory locations, predefined labels and values.

For information regarding the sytax of the assembly level program and further insight, please refer to the project report.
Find a sample program respecting the syntax rules here.

Dependencies:

Language: Python(3.8)

Contents

  • ./assembler - contains the code for the 2 pass assembler
  • ./assembler/hardcode.py and ./assembler/Pass.py are dependencies for the main program ./assembler/wash_assemble.py
  • ./assembler/sample.txt and ./assembler/error_program.txt are sample assembly programs
  • ./assembler/mandatorySBR.txt contains some mandatory subroutines that should be present at the end of the assembly program with user defined values for the declared variables
  • ./assembler/sample.txt - sample input
  • ./assembler/sample_bin.txt - sample output
  • ./assembler/wash_assemble.py - source code

Execution

  • To run the assembler, first change your directory to pywash/assembler/ using the following command:

cd pywash/assembler/

  • Save the assembly level input program in this directory.
  • The process can be run by the following command:

python wash_assemble.py

  • The output binary file named <program_name>_bin.txt can be found in the same directory.

Results

The following results are as per the sample input file and the binary output is available as sample_bin.txt.
image
image