Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit

Project 1 EECS 370 (Fall 2023)

Worth:

100 points

Assigned:

Thursday, August 31st, 2023

Part 1a Due:

11:55 PM ET, Thursday, September 14th, 2023

Part 1s & 1m Due:

11:55 PM ET, Thursday, September 21st, 2023

0. Starter Code

starter_1a.tar.gz files

Description

Makefile

Makefile to compile the project

spec.as

Spec test case assembly file

spec.mc.correct

Correct machine code output for spec test case

starter_assembler.c

Starter code for the LC-2K assembler


starter_1s.tar.gz files

Description

Makefile

Makefile to compile the project

spec.mc

Spec test case machine code file, this is the same as spec.mc.correct from P1A

spec.out.correct

Correct output for spec test case - note that your simulator should write to standard out

starter_assembler.c

Starter code for the LC-2K simulator

There is no starter code for project 1M, the assembly multiplication program.

Feel free to use  wget and  tar as follows:

Try clicking the line numbers to copy terminal commands!

$ wget https://eecs370 .github .io/project 1 spec/starter_1a .tar .gz

2 Saving to: ‘starter_1a .tar .gz



3  starter_1a .tar .gz 100% [==============>]

4  $ tar -xvzf starter_1a .tar .gz

5  starter_1a/

6  starter_1a/spec .as

7  starter_1a/spec .mc .correct

8  starter_1a/Makefile

9  starter_1a/starter_assembler .c



terminal

1 $ wget https://eecs370 .github .io/project 1 spec/starter_1s .tar .gz

2

Saving to:

‘starter_1s .tar .gz

3

starter_1s

.tar .gz 100% [==============>]

4

$ tar -xvz

f starter_1s .tar .gz

5

starter_1s

/

6

starter_1s

/spec .mc

7

starter_1s

/spec .out .correct

8

starter_1s

/Makefile

9

starter_1s

/starter_simulator .c


1. Purpose


This is a 3 part project where you will be coding the following:


Project

Description

Required File(s) for Submission

1A - The LC2K

Assembler

For project 1A, you will write a c program which takes as input an LC2K assembly file (denoted with

) and outputs its correct

machine code representation into a machine code file (denoted with

assembler.c, and a suite of test

assembly files ending in to be ran against your assembler, and buggy instructor assemblers

* .mc

)

1S - The LC2K

Simulator

For project 1S, you will write a c

program which simulates the LC2K ISA, with a given machine code file as input. It will output the simulation to stdout

simulator.c, and a suite of test assembly files ending in * .as . These test files will first be

assembled by the instructor

assembler, and then ran against your simulator, and buggy

instructor simulators.



Project

Description

Required File(s) for Submission

1M - LC2K

Assembly

Multiplication

For project 1M you will write an LC2K assembly program which multiplies two positive 15 bit numbers.

mult.as


2. LC-2K Instruction Set Architecture


Before we dive into project specifics, it is important to understand the LC2K (Little Computer 2000) Instruction Set Architecture. As for this and several of the future projects, you will be gradually

“building” out the LC-2K toolchain and LC-2K simulators. The LC-2K instruction set is very simple, but it is general enough to solve complex problems. To complete project 1’s three parts, you will    need to only know the LC-2K Instruction Set Architecture.


In general, an instruction set architecture defineshow a programmer can use the processor, and what operations the processor supports.

The LC-2K ISA is a RISC architecture (Reduced Instruction Set Computer): This means that it

supports simpler operations. Note that the ISA defines both the assembly language and the machine code. An assembly language is a low level programming language that closely relates to the

underlying machine code. Each line of assembly code can be assembled into 1 line of machine


code, which looks like a bunch of numbers. The machine code is a representation of assembly code, which is usable by the computer.

The machine code file contains the actual values stored in memory (that is, the assembled

assembly code). Specifically we assume that the first line of the machine code file represents the 0th address. Our assembly language also supports the use of symbolic links, and assembler directives. These higher-level operations specify how the assembler should handle the input

assembly language and are not visible in the machine code translation after assembly.


2.1. Description of LC-2K Instructions


Assembly

language

name for

instruction

Instruction

Opcode in

binary

Action

(R-type

instruction)

0b000

Add contents of

results in

(R-type

instruction)

0b001

Nor contents of regA with contents of            , store

results in destReg . This is a bitwise nor; each bit is treated independently.

(I-type

instruction)