https://github.com/willbicks/dsdii-assembler
Assembler for a MIPS processor implemented in VHDL as part of RIT's Digital Systems Design II class.
https://github.com/willbicks/dsdii-assembler
assembler assembly code-generation mips vhdl
Last synced: 4 months ago
JSON representation
Assembler for a MIPS processor implemented in VHDL as part of RIT's Digital Systems Design II class.
- Host: GitHub
- URL: https://github.com/willbicks/dsdii-assembler
- Owner: willbicks
- Created: 2022-03-28T16:22:12.000Z (over 4 years ago)
- Default Branch: main
- Last Pushed: 2023-02-20T16:28:26.000Z (over 3 years ago)
- Last Synced: 2026-01-19T22:59:09.909Z (5 months ago)
- Topics: assembler, assembly, code-generation, mips, vhdl
- Language: Go
- Homepage:
- Size: 51.8 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# ⚙ DSDII Assembler
DSDII Assembler parses MIPS instructions and generates machine code in various formats for a processor developed in RIT's Digital Systems Design II class. The class focuses on the VHDL and Verilog implementation of the processor itself, and this exercise is purely a personal side project.
## Features
### Instruction Parsing:
- [x] R type instructions
- [x] I type instructions
- [ ] J type instructions (not implemented in our processor)
- [x] Pseudo instructions (`nop`, `clear`, `move`)
- [ ] Load immediate (pseudo `li`)
- [x] Support for comments and blank lines
### Code Generation:
- [x] Raw hex machine code output
- [x] Binary machine code output (with optional nibble or byte separators)
- [x] VHDL code generation (byte addressable memory)
- [x] VHDL code generation (word addressable memory)
- [x] Generate VHDL comments with assembly instructions
## Usage
```shell
$ dsdii-assembler -help
Usage of dsdii-assembler:
dsdii-assembler version
dsdii-assembler [options...]
Options:
-i string
Input file containing assembly instructions. If not set, the instruction parameter should contain the singular instruction to be assembled.
-nop-buff uint
Optional number of nop instructions to include after each instruction.
-o string
Output file to write machine code to. (default "stdout")
-out-fmt string
Output format (hex, vhdl-byte, vhdl-word, binary, binary-nibble, binary-byte). (default "hex")
-q Suppress printing version and status to stdout.
```
## Installation
### Without Go Installed:
If you don't have Go installed on your computer, pre-compiled binaries for Windows, macOS, and Linux can be downloaded from the [releases section](https://github.com/willbicks/dsdii-assembler/releases).
Download the appropriate binary for your system, extract it, and add it your path or use it in-situ.
### With Go Installed:
If you have the Go language tools installed on your computer, downloading and installing dsdii-assembler is as simple as:
```shell
$ go install github.com/willbicks/dsdii-assembler@latest
```
This will download, compile, and install the binary in your Go path.
## Examples
```shell
$ dsdii-assembler 'add $s0, $s1, $t3'
dsdii-assembler v0.3.3
022b8020
assembled 1 line(s) in 0 ms
```
```shell
$ dsdii-assembler -i .\test.asm -out-fmt vhdl-byte
dsdii-assembler v0.3.3
-- generated by dsdii-assembler
signal instructions : mem_array := (
x"00", x"00", x"00", x"00", -- nop
x"00", x"00", x"00", x"00", -- nop
x"00", x"00", x"00", x"00", -- nop
x"00", x"00", x"00", x"00", -- nop
x"20", x"10", x"00", x"1f", -- addi $s0, $0, 31 # assembly comments included in VHDL
x"20", x"11", x"00", x"03", -- addi $s1, $0, 3
x"20", x"12", x"00", x"04", -- addi $s2, $0, 4
...
x"00", x"00", x"00", x"00", -- nop
x"02", x"11", x"40", x"20", -- add $t0, $s0, $s1
x"02", x"11", x"48", x"24", -- and $t1, $s0, $s1
x"02", x"11", x"50", x"19", -- multu $t2, $s0, $s1
others => x"00"
);
assembled 37 line(s) in 9 ms
```
## Contributions
Contributions are welcome via pull request, as well as discussions via issues. Please ensure that all contributions are appropriately documented and tested.