A program that converts a decimal number to its binary representation. The converter includes both Java and MIPS assembly implementations.
This project provides a decimal-to-binary converter implemented in Java and MIPS assembly language. The goal is to convert a real number, including both the whole and fractional parts, into its binary representation.
-
Java Implementation: The
dec2bin.javafile contains the main program written in Java. It utilizeswhole2bin.javaandfractional2bin.javafor converting the whole and fractional parts, respectively. -
MIPS Assembly Implementation: The
dec2bin.sfile provides the same functionality as the Java program but is implemented in MIPS assembly language. It includes subroutines such aswhole2bin.sandfractional2bin.s.
Compile and run the Java program as follows:
$ javac dec2bin.java
$ java dec2bin <whole> . <fractional> <precision>Replace <whole>, <fractional>, and <precision> with appropriate values.
Use the MIPS assembly program through the provided utility:
$ mips_subroutine dec2bin <whole> . <fractional> <precision>Again, replace <whole>, <fractional>, and <precision> with appropriate values.
dec2bin.java: Main Java program.whole2bin.java: Java implementation for converting the whole part.fractional2bin.java: Java implementation for converting the fractional part.MIPS_OS_Interface.java: Java interface for interacting with MIPS assembly.dec2bin.s: MIPS assembly implementation.whole2bin.s: MIPS assembly implementation for converting the whole part.fractional2bin.s: MIPS assembly implementation for converting the fractional part.
- Java Development Kit (JDK) for compiling and running Java programs.
- MIPS assembly environment for running MIPS programs.
This project is licensed under the MIT License.