Week 6 - CMP Lock- and Lockless-ASM Coding
See subfolder Labs/Lab06-CMP
.
Overview
In this lab, we provide a pre-compiled implementation of our 4-core, 4-way threaded CMP design. You will need to write MIPS assembly code to perform a matrix (vector) multiplication with each thread responsible for 1 set of input elements and then producing the final result, taking care to ensure appropriate synchronization.
You will first implement a lock-based approach (mmult-lock
subfolders) and then a lockless approach (mmult-lockless
subfolders).
We provide a basic MIPS “assembler/compiler” written in Perl, so you will need to install Perl on your machine. We recommend Strawberry Perl for Windows users. Linux users likely already have Perl installed.
Prelab
Please review the CMP material from lecture including the presentation regarding the LL
/SC
instructions and their usage.
Procedure
The majority of the procedure is outlined the slide presentation for this lab posted as a PDF in the lab folder listed at the top of this page. Please refer to that for the specifics of what you need to do and how to “compile” your ASM code and simulate your design.
Lock-Based Design
Files for the lock-based implementation can be found in src/asm/mmult-lock
and sim/mmult-lock
. Please enter the compilation Perl command listed in the slide presentation carefully as you must ensure you give the appropriate input (e.g. mmult-lock
and output folder paths (../../sim/mmult-lock
).
Lockless-Based Design
Files for the lock-based implementation can be found in src/asm/mmult-lockless
and sim/mmult-lockless
. Please enter the compilation Perl command listed in the slide presentation carefully as you must ensure you give the appropriate input (e.g. mmult-lockless
and output folder paths (../../sim/mmult-lockless
).
Lock-Based Submission
- Online Submission: Copy over the following files to your SCF account
- From
src/asm/mmult-lock
copymmult-lock-core0.asm
,mmult-lock-core1.asm
,mmult-lock-core2.asm
, andmmult-lock-core3.asm
- From
sim/mmult-lock
copyinst0.txt
,inst1.txt
,inst2.txt
,inst3.txt
, andDM_Final_Contents.mem
names.txt
- From
- Then run the following submission command (which is all one line).
submit -user ee560 -tag mmult-lock mmult-lock-core0.asm mmult-lock-core1.asm mmult-lock-core2.asm mmult-lock-core3.asm inst0.txt inst1.txt inst2.txt inst3.txt DM_Final_Contents.mem names.txt
Lockless Submission
- Online Submission: Copy over the following files to your SCF account
- From
src/asm/mmult-lockless
copymmult-lockless-core0.asm
,mmult-lockless-core1.asm
,mmult-lockless-core2.asm
, andmmult-lockless-core3.asm
- From
sim/mmult-lockless
copyinst0.txt
,inst1.txt
,inst2.txt
,inst3.txt
, andDM_Final_Contents.mem
names.txt
- From
- Then run the following submission command (which is all one line).
submit -user ee560 -tag mmult-lockless mmult-lockless-core0.asm mmult-lockless-core1.asm mmult-lockless-core2.asm mmult-lockless-core3.asm inst0.txt inst1.txt inst2.txt inst3.txt DM_Final_Contents.mem names.txt