联系方式

  • QQ:99515681
  • 邮箱:99515681@qq.com
  • 工作时间:8:00-23:00
  • 微信:codinghelp

您当前位置:首页 >> Java编程Java编程

日期:2020-11-19 11:37

COMP1027 – Computer Fundamentals

Session Semester Autumn

Module Name Computer Fundamentals Code COMP1027

Module Convenor(s)

(CW Convenor in Bold)

Amr Ahmed

Coursework Name Exercise 3 (part 3 of the Coursework) Weight 20%

Deliverable

(a brief description of what is

to be handed-in; e.g.

‘software’, ‘report’,

‘presentation’, etc.)

Please see details (last page) in the assignment document (below), including

list and description of the required tasks and details of the submission.

Group Submission ONLY

Details explained in the “Submission Details” section (last page, below)

Format

(summary of the technical

format of deliverable, e.g.

“C source code as zip file”,

“pdf file, 2000 word max”,

“ppt file, 10 slides max”, etc.)

As explained in the “Submission Details”, (last pages, below).

All the required files.

Issue Date 9

th November 2020 (HACK already started in Lab on 5th Nov)

Submission Date November 2020 (22:00) nd 22

Submission Mechanism Online, through moodle.

Late Policy

(University of Nottingham

default will apply, if blank)

Feedback Date Usual 15 working days.

Feedback Mechanism Online, on moodle.

Instructions See the Ex3 document (below)

Assessment Criteria All chips & code will be tested through testing scripts.

Developed and working properly ? full mark of the component

(unless there is any concern of any cutting corners/plagiarism,….etc.).

Missing any required file(s), using different formats, naming,…etc. will attract

presentation penalty.

? Marks of this Ex3 submission will be modified by multiplying by a

factor from the VIVA process, which can heavily affect the final mark

(depending on the demonstrated understanding of the group &

individuals in the viva)

COMP1027 – Computer Fundamentals

2

Exercise 3: The Hack Computer (All together)

(Covering Teaching Weeks 7-9)

[ GROUP Submissions are Assessed, worth 20%]

Introduction

In total, the coursework (lab work, split into multiple submissions, and assignments) is worth

50% of your final mark.

This exercise has TWO parts, as you can see below. But first, in Task 0, you need to download

the files required for this exercise, which specifies the folder structure and names for the

submission.

Task 0: Download Files [ALL]

Ex3-Files.zip provides all the sekelton .hdl and .asm (as well as most of the related tst and cmp

files).

? Download the Ex3-Files.zip file, from the “Exercise 3” area on moodle.

? Extract the files and fill in the required HDL and Assembly codes, as per the tasks in this

document (both part1 and part2, in there respective folders).

? MAINTAIN the same folder structure, file names, and all test & compare files, when you

submit. You can add any additional files you may need to get your submissions working

properly.

Marking note

? See the associated “Marking Sheet”, on moodle, for the breakdown of marks.

? You are allowed to use Built-in chips, for chips/gates already done in the previous exercises

and/or any auxiliary chips that you may need (except any of those that are required, to be

developed, in this exercise 3 itself).

? All chips & code will be tested through testing scripts.

? Marks of this Ex3 submission will be modified by multiplying by a factor from the VIVA process,

which can heavily affect the final mark (depending on the demonstrated understanding of the group &

individuals in the viva)

This exercise has TWO parts.

COMP1027 – Computer Fundamentals

3

Part 1: Assembly Code [ 35% of Ex3 marks]

In this part of the assignment, you are required to provide two Assembly

programs (for the HACK computer) to the following tasks:

a. An Assembly code that does Multiplication: [GROUP]

? Implement a multiplication Assembly code that multiplies R1 (RAM[1]) and

R2 (RAM[2]) and stores the result in R3 (RAM[3]).

Hint: Obviously, there is no multiplication instruction/code to use (the underlying

ALU can only add numbers). So, how do you perform a multiplication for two

numbers A and B? Well, you can just add A for B-numbers of times. For example,

if B is 3, then A x B is the same as A + A + A. Here, you would treat A as a stored

constant while B is a variable that you keep track of.

? If you make no progress. Why don’t you implement the “algorithm” in CLanguage

and use what you learn from the “Addition” example, demonstrated in

details in the lecture and lab, to come out with the corresponding machine code for

this task.

b. An Assembly code that does Factorial: [GROUP]

o Implement an Assembly program to calculate the factorial of a given

number n, F(n). A factorial of a number is given by:

F(n) = n*(n-1)*(n-2)*......*2*1

o The user should enter the value of the number n into R0. i.e. RAM[0]

o The factorial result F(n) should be saved in RAM[1].

SUBMISSION: SUBMIT your answers, i.e., completed Mult.asm and Factorial.asm

files (and all associated tst and cmp files).

P.T.O ?

COMP1027 – Computer Fundamentals

4

Part 2: The Hack Computer [65% of Ex3 marks]

Context, Description, and suggestions:

? In the previous exercises and lab sessions, we used combinatorial and sequential logic

circuits to construct many of the various core logic circuits that form the basis of a CPU and

Memory.

? This exercise concludes all the effort by completing the construction of the Hack computer,

i.e. putting it all together and have the Hack Computer working & executing instructions.

o Firstly, The Memory will be built according to the Hack architecture.

o Secondly, the CPU will combine the ALU and other circuits. But you’ll need to

develop the “Control Unit” that manages the data flow and execution of instructions.

o Finally, all are connected together as one chip (the “Computer”)

o You should go through Lecture slides, Chapter 5 and Appendix A of the primary text

carefully.

? More lab reading resources are available at www.nand2tetris.org/05.php. In particular, go to

the Resources subsection, download “Chapter 5” (and relevant appendices).

? Note that for this exercise, all tasks are made in Group work. You are encouraged to break

your group into subgroups, each working on a different task. You should finish your tasks

faster this way. However, you must maintain communication between subgroups, that is,

every single member is expected to be able to explain the design & implementation for each

individual task (this will be verified during the VIVA examination, after the submission).

NOTEs:

? Do not worry if you didn’t manage to complete any of the previous exercises, or your

implementation (from previous exercises) doesn’t work correctly since nand2tetris provides

built-in implementations (implemented in Java) of all the required chips. To ensure you use

these built-in implementations, we recommend you keep the files for this exercise away from

the previous exercises (and you MUST maintain the provided folder structure).

All files, for Part2, will be under ONE folder (i.e. NO Sub-folder

under Part2). Please see & stick to the provided zip file & its folder

structure & file names

Task A: Memory [GROUP]

? Implement the Memory chip.

Hint: The specification for the memory chip is described in the lecture and Chapter 5. Note

that you would have to use RAM16K, Screen, and Keyboard ‘parts’ (built-in, but you should

refresh yourself with its interface specifications in Chapter 5, for the latter two).

COMP1027 – Computer Fundamentals

5

? If you make no progress. You need to understand what makes a memory chip – there is this

need for addressing/selecting “memory banks”. How do you select between 3 outputs

(RAM16K, Screen, Keyboard)? (Mux4Way*? DMux4Way*?). You still need to

interpret/decode a 15-bit address and pass them through to the right “memory banks”

(RAM16K, Screen, or Keyboard). The memory addresses are already given to you (e.g.

lecture slides, and Chapter 5). The ‘logic’ for interpretation/decoding would make more sense

once you convert them to binary. You would note that only certain address bits are crucial for

selection.

SUBMISSION: SUBMIT your answers, i.e., completed Memory.hdl file (and associated tst

and cmp files).

Task B: CPU [GROUP]

? Implement the CPU chip.

Hint: This may be the most challenging task – So, give it enough attention. The CPU

implementation (framework) is given in the lecture and Chapter 5, Section 5.3.1. In general,

the CPU as a complex logical gate would fetch and execute instructions in their

corresponding A- and C-Instruction codes (16-bits long).

? If you make no progress. Look at the Chip diagram of CPU implementation in the lecture

and in Chapter 5. Adopt a divide-and-conquer approach, that is, try to solve the problem by

parts. Use this skeleton and compare with the Chip diagram:

// Instruction decode

// Use a combination of elementary logical gates to decode the instructions

// You should first decode between A and C-Instructions,

// then the computation and destination

.

.

And (a=cInst, b=instruction[4], out=destD);

.

.

// A register and input mux

Mux?? (…);

?? (…);

ARegister (…);

// D register

DRegister(in=aluOut, load=destD, out=dReg);

// ALU and input mux

Mux16 (…);

ALU (…);

COMP1027 – Computer Fundamentals

6

// PC with jump test

// Use a combination of elementary logical gates to implement the truth table for jump

// functions, given in lectures.

// For example, try to figure out why one implementation would make use of:

// Or (a=jle, b=jgt, out=jmp);

.

.

PC (in=aReg, reset=reset, inc=true, load=jmp, out[0..14]=pc);

NOTE: the above pseoudo-code is for illustration purposes only. It may NOT be complete/accurate for the HDL

similar. You only use it as a guide/hint.

SUBMISSION: SUBMIT your answers, i.e., completed CPU.hdl file (and associated tst and

cmp files). You are also required to submit a full circuit diagram of your CPU implementation.

Task C: Computer [GROUP]

? Implement the Computer chip.

Hint: This is easy, and as a bonus only 3-lines of code:

CPU (inM=??, instruction=??, reset=??, writeM=??, outM=??, addressM=??, pc=??);

Memory (in=??, load=??, address=??, out=??);

ROM32K (address=??, out=??);

? The provided zip file contains couple of test files (e.g. ComputerMax, ComputerAdd,

ComputerRect), to test your Computer chip. Make sure to utilize them and properly test your

chip before submission.

SUBMISSION: SUBMIT your answers, i.e., completed Computer.hdl file (and associated

tst and cmp files).

? P.T.O ?

COMP1027 – Computer Fundamentals

7

FINAL SUBMISSION INSTRUCTIONS

1. For All Tasks, students are required to work in small groups (as listed).

2. Each group will have ONE submission ONLY (by one nominated member of the group).

3. The nominated member, for each group, should notify us about the submission and indicate

which group he/she represents.

4. We reserve the right to ask all/some students to explain any/all of their submitted work at

any time. Failure to answer/respond appropriately could affect your marks.

5. The group submission must be submitted through Moodle as a ZIP archive containing all

the requested files (same folder structure as per the downloaded file). The ZIP file should

be named as CSF-Ex3-XX.zip, where XX is the Group Number.

6. NOTE about the Compressed File:

a. Use .ZIP format ONLY (any other compression formats is NOT acceptable and will

result in you losing marks for not adhering to instructions).

b. Compress the whole folder structure/tree only (see the provided zip file, for an

example). i.e. Avoid compressing each individual folder/file. Nested compression will

prevent the marking process and could result in marking scripts failing, and hence

losing a lot (if not all) of marks.

Click on the “Exercise 3” link under “Coursework Submission”. Take note of the

Deadline 22nd November 2020, 22:00.

Any submission after this will be subject to the usual penalty rule.

There will be a VIVA (oral examination) after the submission. The result of

the viva could highly affect the final mark of the group and individuals

(depending on the demonstrated understanding in the viva).

------------------------------------------- Best Wishes -----------------------------------------------


版权所有:留学生编程辅导网 2020 All Rights Reserved 联系方式:QQ:99515681 微信:codinghelp 电子信箱:99515681@qq.com
免责声明:本站部分内容从网络整理而来,只供参考!如有版权问题可联系本站删除。 站长地图

python代写
微信客服:codinghelp