Build Your Own PC - Java-based Compiler and Assembler
Overview
Build Your Own PC is a Java project simulating a basic computer architecture, including memory, an Arithmetic Logic Unit (ALU), registers, and a compiler. Developed as an assignment, it focuses on using Java commands to assemble and compile code, providing low-level operation simulations and memory management.
Key Components
- Memory Management: Simulates computer memory, allowing register manipulation and memory access.
- Arithmetic Logic Unit (ALU): Executes logical and arithmetic operations as per the instructions.
- Registers and Bit Operations: Implements registers and basic bit manipulation, supporting various computational commands.
- Assembler and Compiler Integration: Uses Java commands to compile and assemble instructions, enabling the simulation of basic computer processes.
Unit Test Cases
The project includes a comprehensive suite of unit tests to ensure the correct functioning of each component. Here’s a breakdown of the test cases:
- Register Filling Test:
- The filler()function fills registers with predefined values, ranging from 0 to 15, simulating data population in memory.
 
- The 
- ALU Tests:
- Two separate tests (ALUtestandALUtest1) to verify the functionality of arithmetic and logic operations.
- Commands include loading and executing instructions with cpu.preload()andcpu.run().
 
- Two separate tests (
- Move Operation Tests:
- movetestand- movetest1simulate moving data between registers, ensuring correct data handling and transfer within memory.
 
- Halt Tests:
- Two test cases, halttestandhalttest1, are included to test the halt functionality, simulating the stopping of processes.
 
- Two test cases, 
Sample Test Execution
Each test case simulates CPU operations using preloaded commands. Example output:
// Test: ALU Operations
System.out.println("-----------------CPU 0 [ALU test]---------------");
cpu.fillregister(filler());
cpu.preload(ALUtest);
cpu.run();
Tech Stack
- Programming Language: Java
- Frameworks/Libraries: Java core libraries
- IDE: NetBeans
- Features: Memory, ALU, Longword, Assembler, Bit manipulation
Development & Setup
This project is developed in Java and requires NetBeans IDE for testing and modification.
- 
Clone Repository: git clone https://github.com/yourusername/build-your-own-pc cd build-your-own-pc
- 
Run Tests: - Open Computer_testin NetBeans IDE and run theruntests()function to execute all test cases.
 
- Open 
Access & Documentation
Since this is an offline project, all functionalities and tests can be run directly within NetBeans.
This project demonstrates a foundational understanding of computer architecture principles, including memory, ALU, and compiler simulation, implemented in Java.