COMP2300 6300 ENGN2219 Assessments Assignment 1: Build and

COMP2300/6300/ENGN2219 / Assessments / Assignment 1: Build and

Extend a CPU

Assignment 1: Build and
Extend a CPU
Implement the processor microarchitecture for the

A Digital Circuit

On this page

Rules and Policies

Allowed Components

Background

Speci�cation

Part 1 (30 marks)

Part 2 (70 marks)

Extension Implementation and Testing

Design Report

Deliverables

Additional Files / Sub-circuits

Marking Criteria

https://cs.anu.edu.au/
https://comp.anu.edu.au/courses/comp2300/
https://comp.anu.edu.au/courses/comp2300/assessments/
https://comp.anu.edu.au/courses/comp2300/assessments/assignment-1/

Submission

Getting Started

Completion Checklist

Report pdf Artifact

My circuits don’t work, can I email you for help?

It’s [5 minutes, 60 minutes, 12 hours] before the deadline and my CI Jobs aren’t

How do I know my assessment has been submitted?

I’ve done X, is that good enough to get Y marks?

In this assessment you are going to complete a number of Digital �les

to a required spec, much like what you have already been doing in the

The �rst part of this assignment builds upon the following labs:

Lab 1: Introduction

Lab 2: ALU

Lab 3: Registers

Lab 4: Manual CPU

Lab 5: Auto CPU

Lab 6: Conditional Execution

If you have not completed the tasks in the above labs or do not

understand the content, we strongly recommend that you �rst

complete the labs and then start the assignment.

Deadline: 11 April 2023, 10:00 am

Assessment template: link

https://comp.anu.edu.au/courses/comp2300/labs/01-intro/
https://comp.anu.edu.au/courses/comp2300/labs/02-alu/
https://comp.anu.edu.au/courses/comp2300/labs/03-registers/
https://comp.anu.edu.au/courses/comp2300/labs/04-manual-cpu/
https://comp.anu.edu.au/courses/comp2300/labs/05-auto-cpu/
https://comp.anu.edu.au/courses/comp2300/labs/06-cpu-adv/
https://gitlab.cecs.anu.edu.au/comp2300/2023/comp2300-2023-assignment-1

Speci�cation: keep reading 🙂

Weighting: 25%

Marked out of: _ / 100

Rules and Policies

this is an individual assessment task, ensure you fork your repo as

you may re-use designs / �les from your labs

if you do, please cite them in the

statement-of-originality.md
it is your responsibility to ensure any additional �les are

included in the repo and pushed to gitlab correctly

your main solution still needs to be in the provided �les

all submitted �les should abide by the style guidelines

late submission is not permitted without an extension

it is your responsibility to ensure that your changes have been

submitted to gitlab, what is present on gitlab at the time of the

deadline will be considered your submission

Allowed Components

You may use any component digital provides you, with the following

exceptions:

https://comp.anu.edu.au/courses/comp2300/resources/digital-style/
https://comp.anu.edu.au/courses/comp2300/policies/#late-submission
https://comp.anu.edu.au/courses/comp2300/policies/#extensions

VHDL / Verilog / Anything outside of Digital

Some extensions prohibit the use of certain components, check the

extension page for details

Submissions that use any of the above will have marks deducted

accordingly.

If this is your �rst time reading the document then skip this for

now and open links as necessary

This assignment has a few external pages that are linked to throughout

the document, for quick reference, here they are in one spot:

QuAC ISA De�nitions

QuAC Individual Instruction De�nitions

Part 2 Extension Options

QuAC Assembler Guide

Design Document Guide

Digital Style Guide

Background

You have been building the CPU from the ground up during the �rst six

labs. The �rst part of this assignment will require you to submit the CPU

that conforms to the QuAC ISA.

The second part is more open-ended and will require you to extend the

base ISA in an interesting way.

Speci�cation

https://comp.anu.edu.au/courses/comp2300/resources/QuAC-extensions/
https://comp.anu.edu.au/courses/comp2300/resources/08-QuAC-ISA/
https://comp.anu.edu.au/courses/comp2300/resources/09-QuAC-full/
https://comp.anu.edu.au/courses/comp2300/resources/QuAC-extensions/
https://comp.anu.edu.au/courses/comp2300/resources/quac-assembler/
https://comp.anu.edu.au/courses/comp2300/resources/design-document/
https://comp.anu.edu.au/courses/comp2300/resources/digital-style/
https://comp.anu.edu.au/courses/comp2300/resources/08-QuAC-ISA/

Part 1 (30 marks)

For the �rst part of the assignment, your task is to deliver a CPU in

Digital that implements the full QuAC ISA speci�cation.

If you have already completed the �rst six labs that result in a

CPU for the QuAC ISA, then congratulations! You have already

completed the �rst part of the assignment… sort of. You still

need to update the �les in the assignment repo and ensure they

are passing the tests there. We aren’t going to refer to your lab

repos, but it is �ne for you to copy your components over.

Complete src/basic-cpu.dig to the full QuAC ISA
speci�cation and ensure it is passing all provided tests.

You src/basic-cpu.dig should contain only what is needed
for Part 1. Your extension and further modi�cations will be

completed in src/extended-cpu.dig . Students who further
extend the src/basic-cpu.dig �le will have marks removed
accordingly.

Part 2 (70 marks)

The QuAC ISA is quite limited in its capabilities compared to

established ISAs, such as ARM and RISC-V. We cannot write very

interesting assembly programs to solve real-world problems. The

primary limitations of QuAC ISA include:

https://comp.anu.edu.au/courses/comp2300/resources/08-QuAC-ISA/
https://comp.anu.edu.au/courses/comp2300/resources/08-QuAC-ISA/

Few logical and arithmetic operations

Limited set of general-purpose registers

ALU instructions cannot directly operate on immediate values

Inability to conditionally execute on anything other than the zero

Lack of a stack and dedicated push / pop instructions (this point
relates to functions)

Your objective in this part of the assignment is to extend the QuAC ISA

in a meaningful manner. To this end, you should note that the QuAC ISA

deliberately has large gaps in the speci�cation:

Eight of the 16 possible operation codes (opcodes) are unde�ned.

New instructions can thus use these opcodes and even de�ne a

new encoding format other than R-Mode or I-Mode.

Bits [3] and [7] in the R-Mode encoding format are only
de�ned if both are zero (allowing each R-Mode instruction to have

three alternate meanings based on the values of bits [3] and

One of the register codes is unused, allowing for another special

purpose register (check here to see which register codes are used).

Bits [4:15] in the �ag register are unused.
The outcome/behaviour of writing to the �ag register is unde�ned.

This means that you could de�ne writing to the �ag register in the

usual fashion (if you for some reason wanted to set/clear the �ag

bits directly) or you could add a write-only register that shares the

same register code as FL (reading register code 101 reads from
FL , writing to register code 101 writes to the new register.)

Your extension can broadly be whatever you like, but keep in mind that

sophistication of the extension is part of the marking criteria.

Here is a list of potential extensions that you might like to consider,

though if you have your own ideas, run them by your tutor �rst to check

for suitability.

https://comp.anu.edu.au/courses/comp2300/resources/08-QuAC-ISA/#registers
https://comp.anu.edu.au/courses/comp2300/resources/QuAC-extensions/

Your CPU with ISA extensions must be backwards compatible

with the base QuAC ISA.

This means that any changes you make must:

involve new instructions using currently unde�ned opcodes

use unde�ned bits in existing instructions (or both)

if it interacts with existing instructions it must explicitly be

an improvement that does not change the expected

outcome from the base ISA

Extension Implementation and Testing

To be able to demonstrate and test the capabilities of your extension,

you must make any necessary additions to the quac.json assembler
con�g �le to add support for your extensions, such that anyone can use

it on your submitted CPU.

Remember that the base ISA must still work, so you cannot change any

existing instruction con�gs.

Once this has been completed, you must write at least one assembly

program, demo.quac , that demonstrates your extension.

For more help on this, check out the assembler guide page.

Design Report

Your assignment will also require the submission of a <1000 words design report describing the design decisions you made to implement the base ISA and your extension. More speci�cally, we would like to see: A high level overview of your extension What modi�cations you have made to the ISA https://comp.anu.edu.au/courses/comp2300/resources/quac-assembler/ https://comp.anu.edu.au/courses/comp2300/resources/design-document/ What is the key bene�t(s) of your changes The implementation details about your modi�cations, eg: The required changes to the microarchitecture Impact of changes on the CPU A small walkthrough of the example program Analysis of the tradeoffs / limitations with your implementation You will need to successfully implement a complex extension backed up by an excellent design report to get a mark in the HD range. See more here. Your design report should precisely describe your extension and its behaviour and encoding in a format similar to the full ISA description. Note that we say < 1000 words. If you feel you have addressed all of what has been asked of you in less words, please don’t feel the need to hit 1000 words. You will end up writing a worse report by reducing the conciseness of it. Complete src/extended-cpu.dig to the full QuAC ISA speci�cation and then extend it based on the information provided above. Provide at least one assembly program demo.quac that demonstrates your extension (further �les should be added and named accordingly, eg: demo-stack.quac ). Finally, write a design report in report.md detailing your extension. https://comp.anu.edu.au/courses/comp2300/resources/09-QuAC-full/ https://comp.anu.edu.au/courses/comp2300/resources/08-QuAC-ISA/ Deliverables To successfully complete this assignment, the following �les must be submitted: �� src/basic-cpu.dig containing your CPU that implements the full QuAC ISA, but no extensions beyond that �� src/extended-cpu.dig containing your CPU that implements the full QuAC ISA and has been extended beyond the base capabilities �� quac.json containing the default quac instructions and any extra instructions, etc. that you have added �� demo.quac containing the QuAC assembly program that demonstrates your extension optional demo-XXXXX.quac containing further assembly programs that demonstrate other aspects of your extension �� report.md containing your <1000 word design report optional assets/* containing any images you want to add in your report Additional Files / Sub-circuits We provide the �les src/basic-cpu.dig and src/extended-cpu.dig as templates that contain only the dual-port memory module. You should build the CPU(s) in these �les. For any other additional sub-circuits (e.g alu.dig , reg_file.dig , control_unit.dig ), please place them in the src/ directory. If your part-1 or part-2 use differing versions of these sub-circuits, then please name them appropriately. Marking Criteria Your assessment will be evaluated on the following criteria: �� Correctness of your implementation of the base ISA (30/100) �� Sophistication and Correctness of your extension of the base ISA �� Explanation and Reasoning of your extension of the base ISA Item 1 will be evaluated primarily through the results of your Digital tests and visual inspection. Item 2 will be evaluated primarily through visual inspection of the Digital �les and the assembly program demonstrations. Item 3 will be evaluated through your report.md and the quality of the writing within. Items 1 and 2 will also be evaluated by visually inspecting your submissions for neatness, ef�ciency and logical layout. For more information on how to lay things out well in Digital, check the style We will take the following aspects into account during the marking of the assignment: Functional correctness Your CPU must be able to run assembly programs written in the base QuAC ISA correctly. You must demonstrate the correctness of your extended CPU with a carefully written assembly program that uses the new extension. We will verify. Succinctness, clarity and neatness of CPU design and organization No spaghetti wiring Wise use of diagonal wires (seldom) Avoid easily preventable wire crossings Avoid running wires under other components Take care that the data �ow in typical combinational circuits is left-to-right Appropriate use of comments to explain circuit sections Sensible use of abstraction https://comp.anu.edu.au/courses/comp2300/resources/digital-style/ Your design should be easy to understand, this includes the packaging of abstractions For more info, check the style guide Modularity How easy would it be to modify your CPU and/or add other extensions? Avoiding wasteful duplication of hardware An ALU that is not using the same full adder for addition and subtraction is wasteful Adding an increment instruction should not use another adder If an instruction can be synthesised from existing instruction(s) (namely pseudo-instruction), then adding new hardware for the instruction is wasteful. The one exception is that adding hardware for the new instruction results in a more ef�cient execution than utilizing existing instructions, i.e., the software- only approach. Gate minimisation Your design does not need to be optimal, but large sprawling, easily minimizable circuits will be penalised. Modi�cations to the control unit and ALU should have corresponding additional tests added New instructions should have some example code demonstrating how they work Submission Submission is through GitLab, the most recently pushed commit of your fork of the assessment template before the deadline is taken to be your assessment submission. Getting Started �� read this assessment page completely https://comp.anu.edu.au/courses/comp2300/resources/digital-style/ https://gitlab.cecs.anu.edu.au/comp2300/2023/comp2300-2023-assignment-1 �� fork and clone the assessment template ensure you fork your project as private do NOT change the name or path of the repo, or it may get missed by our software �� work on each part, testing, committing and pushing as you go �� make a mistake or get stuck, then ask a good question on the course forum. Completion Checklist you have submitted the �les listed above you have checked that you haven’t used any of the components listed above you have run your �les local test(s) and they pass successfully you have laid out all of your circuits using good practice you have saved, committed and pushed your Digital �les to gitlab you have �lled out, committed, and pushed your statement-of-originality.md you have �lled out, committed, and pushed your report.md you have checked the report pdf artifact on gitlab to ensure it is you have checked the gitlab ci tests and they are passing Report pdf Artifact https://gitlab.cecs.anu.edu.au/comp2300/2023/comp2300-2023-assignment-1 https://edstem.org/au/courses/10870/discussion/ https://comp.anu.edu.au/courses/comp2300/resources/digital-style/ Your repo will be packaged into a report pdf for marking purposes. As such it is important that you see what the result of the pdf job is and make sure the output makes sense. take your name and uid from the statement-of-originality.md take images from your basic-cpu.dig and extended-cpu.dig �les take test results of �les take your report from report.md take references from the statement-of-originality.md take images from all other digital �les combine all of them into a single pdf To view the pdf, �rst click the ci icon on your most recent commit (as above), then click on the pdf job. Then, you’ll be taken to the job page, where you should see a “Job Artifacts” section, click on the Download button. This will download a zip �le containing your pdf. Which should look something like this. There is more general info about gitlab ci here. My circuits don’t work, can I email you for help? https://comp.anu.edu.au/courses/comp2300/resources/faq/#gitlab-ci Sorry, you won’t get help over email or Teams. We provide a course forum which is the only way we are able to help. Forum posts related to your assessment submission must be “private” (as for any individual assessment task). It’s [5 minutes, 60 minutes, 12 hours] before the deadline and my CI Jobs aren’t �nishing! Unfortunately on the day that an assessment is due, when many students are pushing updates at once, the CI servers can’t keep up. You may not see your CI jobs �nish before the deadline. You will just have to manually check that your �les have been submitted correctly and that you are passing tests locally. The best way to avoid this issue is to start early and �nish early 😇 If there’s any issues with your git repository after the deadline. Please let us know (after the deadline) through a private forum post and there may be something we can do. How do I know my assessment has been submitted? �� the �les in your fork of the assessment are correct (i.e., the �les you intend to submit) when checking on the gitlab website �� the time is before the deadline then your assessment has been submitted (well done!). Please don’t ask us to “check”, we would be just doing exactly the same thing as the above steps which you can do yourself. I’ve done X, is that good enough to get Y marks? https://edstem.org/au/courses/10870/discussion/ We don’t give out marks before assignments are completed, but it’s fair to wonder “How hard should I work on this?” Realistically there are ways to complete this assignment with minor modi�cation of what you have done in labs. Those types of submissions will be likely to get in the range of 50-59 indicating “satisfactory” performance, but not what we would call “good”. Putting in a normal amount of further effort to create a submission that is “good” or “very good” will result in a mark between 60-79. Most students will be in this category. Don’t neglect your design report as explaining your extension is worth the same number of marks as the extension implementation itself. Getting higher than 79 requires an “excellent” submission across all marking criteria. This requires sophisticated engagement with the task and probably some kind of extension. For very high marks (90+): “we know it when we see it”. Only a few students will be in this category and they will have de�nitely put in a lot of effort to create a sophisticated extension on the basics. They will also have written an impeccable design report. At the opposite end of the scale, if we see a submission that doesn’t meet the speci�cation (e.g., it violates the QuAC ISA, doesn’t fully work, or there is a very weak design report), then the mark will be below 50. Hopefully, there are only a few students in this category. Sorry that we can’t be more speci�c than that. https://twitter.com/anucecc https://facebook.com/anucecc https://instagram.com/anucecc https://www.youtube.com/user/ANUexperience https://www.linkedin.com/showcase/anucecc https://www.anu.edu.au/news/publications-social-media/anuaustralia Acknowledgement of Country The Australian National University acknowledges, celebrates and pays our respects to the Ngunnawal and Ngambri people of the Canberra region and to all First Nations Australians on whose traditional lands we meet and work, and whose cultures are among the oldest continuing cultures in human history. Contact ANU Disclaimer https://www.anu.edu.au/about/partnerships/association-of-pacific-rim-universities https://www.anu.edu.au/about/partnerships/international-alliance-of-research-universities https://www.anu.edu.au/about/partnerships/edx https://www.anu.edu.au/about/partnerships/group-of-eight https://www.anu.edu.au/contact https://www.anu.edu.au/copyright https://www.anu.edu.au/disclaimer https://www.anu.edu.au/privacy Freedom of Information +61 2 6125 5111 The Australian National University, Canberra TEQSA Provider ID: PRV12002 (Australian University) CRICOS Provider Code: 00120C ABN: 52 234 063 906 https://www.anu.edu.au/freedom-of-information