MINERVA-8
- 2 Devlogs
- 32 Total hours
This is MINERVA-8 - A custom 8-bit assembler
This is MINERVA-8 - A custom 8-bit assembler
over the last few weeks, I have been working on many test cases.. I have added many negative test cases where I try to pop from an empty stack or ‘ret’ instruction without a call. I found many issues that i fixed in the last few weeks. I have also written a fibonacci series using my instruction set and have been successfully able to ‘OUT’ the result to console.
This has been my most proud activity. It took me 4-5 days to come up with fibonacci flow as I was hand-calculating the output using my instructions. When I tried it , i was getting wrong answers. My step flag helped me debug the flow and eventually I could come up with correct fibonacci instruction flow. I have put many examples in the release folder. In the release folder, I have put Minerva-8.exe which takes the file name <fibonacci.asm> as an argument. It also takes additional optional arguments such as [–step | –ram] . The –step argument provides the user with the ability to debug instruction by instruction flow and shows the CPU state after execution of every instruction. This helped me debug my own fibonacci.asm which took quite a bit of time.
Also, I have struggling with logging hours on hackatime. My github is on [email protected] account and i logged to hackatime using [email protected]. Using the help from slack and some from Google , I tried to link both the emails but it is still not clear on why it shows 0hours when hackatime clearly logged 30hrs for Minerva-8 and 1:30 hrs for compiler
In my 10th grade Summer, I took C++ course in Folsom Lake Community College. The Professor was teaching about how C++ code gets converted to Assembly language, how the assembler converts the Assembly instructions into Machine code then the CPU will execute the machine code. I got confused and asked my friends on what that means. My friends did not know it either. At home, my dad explained with a block diagram. I got more curious about the innerworkings and read the documentation of RISC-V instruction set. This led me to come up with MINERVA-8 a custom CPU 8 bit architecture.
MINERVA-8 (CUSTOM 8-BIT ASSEMBLY LANGUAGE) is a console-based 8-bit CPU simulator written in C++ that demonstrates how a processor executes instructions through the fetch-decode-execute cycle while showing changes to registers, memory, flags, and control flow.
The project includes a custom assembler that translates MINERVA-8 assembly language into machine code and loads the resulting instructions and data into 256 bytes of simulated RAM.
MINERVA-8 currently includes:
The fetch unit uses the Program Counter to retrieve the next opcode from RAM.
The decoding unit determines which instruction the opcode represents and identifies any associated operand or memory address.
The execution unit performs the requested operation. Depending on the instruction, it can:
LDA
Load a value into Register A
LDB
Load a value into Register B
LDM
Load a value from memory into Register A
ADD
Add Register B to Register A
SUB
Subtract Register B from Register A
STA
Store Register A in memory
OUT
Output Register A as a number
OUTC
Output Register A as an ASCII character
JNZ
Jump if the Zero Flag is not set
JZ
Jump if the Zero Flag is set
JMP
Unconditional jump
AND
Bitwise AND of Register A and Register B
OR
Bitwise OR of Register A and Register B
XOR
Bitwise XOR of Register A and Register B
SHL
Shift Register A left by one bit
SHR
Shift Register A right by one bit
NOT
Invert every bit in Register A
INC
Increment Register A
DEC
Decrement Register A
CMP
Compare Register A and Register B and update flags
PUSH
Push Register A contents to stack
POP
Pop stack into Reg A and update flags
CALL
Call subroutine
RET
Return from subroutine to the caller
HLT
Halt execution