Assignment 1: Assembling The Gr8BOnd

Instruction set design is hard. Prof. Dietz has designed dozens of instruction sets in the three decades he's been a professor, and it still isn't easy for him to get things right. Thus, rather than giving you complete freedom to design your own instruction set, we're going to walk through the design logic for a reasonably well-crafted one that he built specifically for Spring 2020 CPE480. However, this design is not complete -- each student must devise their own encoding of the instructions and implement their own assembler using AIK. The instruction set architecture specification for Spring 2020, missing the instruction encoding, is Gr8BOnd (pronounced "Great Beyond").

Overview Of The Instruction Set

Each semester's processor ISA has at least a few interesting features. Here's what's special in the Gr8BOnd:

Of course, there are also the not-so-special choices made in the Gr8BOnd ISA:

So, you basically start by looking at the list of Gr8BOnd instructions and grouping them together by how you want to encode them. Think about where the register numbers, 8-bit constants, and opcode will go within an instruction word. Each group of instructions can then be written-out as one pattern per instruction type -- or you could use .alias and have just one pattern per group of similarly-encoded instructions. Either way, it's really quite straightforward.

That's about all there is to it... well, almost....

Pseudos

Most assembly pseudo-instructions for Gr8BOnd can simply use the AIK defaults. You don't need to worry about things like renaming .equate. For example, .word is used for allocating an initialized 16-bit word and .origin is used for setting the location counter in the currently active segment. Of course, don't forget to define the two segments and define the register names using .const.

However, the table of Gr8BOnd assembly language instructions given here also includes four things that look like instructions, but aren't. They're the ones where the functionality says "by shortest sequence of instructions." Like the MIPS li pseudo-instruction, each of these are supposed to generate the shortest possible implementation using one or more of the "real" instructions. In effect, they're span-dependent instructions, generating a variable-size encoding depending on the operand value. The first is ci $d,c16, in which c16 is a 16-bit constant value. Depending on that value, there are several possible encodings:

Keep in mind that bits don't have types -- operations on them impose typed interpretations of the bit patterns. As long as the bit pattern in the register ends up as it should be, for example, one could perfectly well use a ci8 to load a pair of 8-bit posit values.

The three other pseudo-instructions are all types of jump instruction, jmp, jnz, and jz. Depending on the 16-bit target address, each of these pseudo-instructions can take from one to four instructions to implement:

Keep in mind that the way AIK specifies pattern right sides doesn't look like assembly instructions, but a list of field values and sizes. To output a sequence of two instruction bit patterns, you need to list values for twice as many (32 bits total) on the right side of the pattern. The pattern that generates four words worth of instructions thus specify values for a total of 64 bits on the right hand side.

Ok, I imagine about now you're looking at the above and wondering what a nightmare this is going to be. Well, they will require a few long lines of AIK specification. To be precise, ci will take three AIK patterns to implement, jmp will take four, and jnz and jz can share four more patterns (if you alias them appropriately). So, we're really talking about as little as 12 lines of AIK specification for all the span-dependent pseudo-instructions. That said, get your assembler working without these pseudo-instructions first. You can still get a good grade if these aren't implemented, but not if the core instruction set doesn't work....

Your Project

Your project is simply to design the instruction set encoding and implement an assembler using AIK. Here's a simple test case:

	.text
start:
	addi	$1, $2
	addii	$1, $2
	addp	$1, $2
	addpp	$1, $2
	and	$1, $2
	anyi	$1
	anyii	$1
	bnz	$1, place
	bz	$1, place
	ci8	$1, 42
	cii	$1, two
	cup	$1, 42
	i2p	$1
	ii2pp	$1
	jr	$ra
place:	ld	$1, $2
	muli	$1, $2
	mulii	$1, $2
	mulp	$1, $2
	mulpp	$1, $2
	.data			; switch to data segment
	.word	42
	.word	601
two:	.word	480
	.text			; back to text segment
	negi	$1
	negii	$1
	not	$1
	or	$1, $2
	p2i	$1
	pp2ii	$1
	shi	$1, $2
	shii	$1, $2
	slti	$1, $2
	sltii	$1, $2
	st	$1, $2
	trap
	xor	$1, $2

No, the above isn't a useful program. Worse still, I obviously can't show you sample output without giving-away how I've encoded the instructions.... Honestly, testing your assembler is virtually impossible; it'll be easy when you have Verilog code implementing the machine to execute these instructions, but not now. So, make sure that the logic behind your encoding is clear, either by the structure of your AIK code or by actual documentation of your reasoning in your Implementor's Notes. Make the TA's grading job easy.

Due Dates

The recommended due date for this assignment is before class, Wednesday, February 19, 2020. This submission window will close when class begins on Friday, February 21, 2020. You may submit as many times as you wish, but only the last submission that you make before class begins on Friday, February 21, 2020 will be counted toward your course grade.

Note that you can ensure that you get at least half credit for this project by simply submitting a tar of an "implementor's notes" document explaining that your project doesn't work because you have not done it yet. Given that, perhaps you should start by immediately making and submitting your implementor's notes document? (I would!)

Submission Procedure

For each project, you will be submitting a tarball (i.e., a file with the name ending in .tar or .tgz) that contains all things relevant to your work on the project. Minimally, each project tarball includes the source code for the project and a semi-formal "implementors notes" document as a PDF named notes.pdf. It also may include test cases, sample output, a make file, etc., but should not include any files that are built by your Makefile (e.g., no binary executables). For this particular project, name the AIK source file gr8bond.aik.

Submit your tarball below. The file can be either an ordinary .tar file created using tar cvf file.tar yourprojectfiles or a compressed .tgz file file created using tar zcvf file.tgz yourprojectfiles. Be careful about using * as a shorthand in listing yourprojectfiles on the command line, because if the output tar file is listed in the expansion, the result can be an infinite file (which is not ok).

Your account is
Your password is


CPE480 Advanced Computer Architecture.