CS350 Assembler

CS350 Assembler - Description

This project is an assembler and simulator I created for my advanced architecture course. In this course, we designed our own 16-bit RISC ISA, then used Verilog to design a proessor from scratch, implementing functionality such as pipelining, memory, out of order execution, concurrent execution, etc. We ran our designs on an FPGA board.

This is a github link to the source code for this assembler. It is part of my web server source code: Assembler Sourcecode

This is a github link to the ISA we created for this class: C16 Instruction Set

I created this assembler and simulator to make testing our assignment processor designs with programs easier -- before, we were only able to test our assignments by directly writing binary into our Verilog code. The entire class used my assembler and simulator to test their projects, and the TA used my assembler to write test cases for grading our projects.

This assembler runs server-side -- it uses no JavaScript. The code is sent to the C++ server I wrote and the resulting output page is dynamically built by the server.

Enter or paste code in the left-most box. Example input is shown at the bottom of this page.


Example Input:

Example Input

Name: Create stack (overwrites existing code)
16-bit 32-Bit Big-endian 32-Bit Little-endian
Simulation Step Count:

The text area above is outside the form element, but should still be a part of the form.

Note: The form attribute is not supported in IE.

To write comments, the syntax is //text for new-line comments. Text after the third word of a line is automatically ignored with or without the comment delimiter.

To store data, type .data on an empty line. To add more code after a .data block, type .code later on following .data All lines after a .data line will be interpreted as plain data (until it encounters a .code line). To skip addresses (skipped addresses will be filled with zeroes by the assembler), type .skip 12 (or a different number if you want to skip something other than 12).

push, pop, callFunc, and ret are special functions -- they do not exist in our ISA, but are instead automatically expanded into c16 instrunctions by the assembler. The expanded code will be shown if these special instrunctions are used. r5 is currently used as a scratch register for intermediate operations done when expanding these instrunctions.

Expanded functions require the stack to be correctly initialized. To set up a basic stack, click the "createstack" button. Doing so will generate a stack of size 64 (arbitrary number -- can be changed). Warning: Clicking "createstack" will clear any existing code.

Example input:

//Initialize stack pointer

lea r6 stackBegin

//start program code here

push 5
pop r4
callFunc myFunc



add r1 r2 r3
add r3 r4 12

//Stack location
.skip 64