ELEC S100F Introduction to Computer Engineering
Take-Home Assignment (OES Component) Submission deadline: 18 Jan 2021 (9:00 am)
Introduction: This is a project to test your knowledge and skills you acquired during the course study. Although you are given one week to submit your project work, the suggested time spending in this project is 1-2 working days. Some of the tasks are straightforward and you should be able to complete them easily. However, some of the tasks are quite challenging and they are used to differentiate more capable students. Be prepared to use your own problem-solving skills in most of the tasks.
Do as many tasks as you can and submit your work before the submission deadline. Please use the project template file to contain your work. Submit your file to the
coursework submission system: https://lab.ouhk.edu.hk/ice/
Task 1: Information representation by binary bits (10 marks)
The following 4 bytes are found in computer memory: 4C 4F 56 45. What is the value if they are used to representation different information? Give your answers by completing the following table.
4 Bytes in Hex Format
4C 4F 56 45
32 Binary Bits Pattern:
IEEE 754 Floating Point Number:
Signed Integer (32 bits):
Unsigned Integer (32 bits):
4 Characters in ASCII:
2 Instructions in LC-3: x4C4F, x5645
1
Task 2: Digital Logic Structures (20 marks)
You can use a 7-Segment display decoder to display 0 to 9 and A to F according to the four inputs. The following shows an example.
Make a circuit that can display 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, b, C, d, E, F in order and repeatedly every 1 second. You can simply use four clock signals as the inputs. Explain your answer.
Make another circuit that can display 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, b, C, d, E, F in reverse order and repeatedly every 1 second. That is, the circuit can display F, E, d, C, b, A, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0 repeatedly. Explain your answer.
Do you think that it is possible to use four clock signals and some logic circuits to make the display to show 2 7 6 8 6 8 5 7 repeatedly? Explain your answer.
Task 3: Von Neumann Model (10 marks)
Watch this video titled ¡°See How a CPU Works¡± (URL: http://lab.ouhk.edu.hk/cewiki/video/see-how-a-cpu-works.mp4). It mentions a fictitious computer called Scott. In this course, you have learnt another fictitious computer called LC-3.
Give and explain two similarities and three differences between Scott and LC-3.
2
Task 4: Assembly Language and Programming (60 marks)
Part A (10 marks)
Write a LC-3 program that can output your full name n times, where n is the number of characters in your name. For example, for a full name ¡°Chan Tat Man¡± (the number of characters is 10), the output of the console is as follows:
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Chan Tat Man
Part B (10 marks)
Write a LC-3 program that can output ASCII art of your given name. You can use this online tool to generate the required ASCII art. http://patorjk.com/software/taag/#p=display&f=Big&t=JOHNNY
For example, for a given name ¡°Johnny¡±, the output of the console is as follows:
3
Part C (20 marks)
Write a LC-3 program that can output the machine code (in binary bit format) of this program. For example, if you program starts at x3000 and ends at x301D, the console should display the memory content of x3000 to x301D in binary bit format.
0011000000000000 0101000000100000 1001010010111111 …
…
… 0000010000000100
Notes: You should use LC-3 Trap code OUT and PUTS to output characters or strings to the console. The jobs for Parts A and B are quite easy, while Part C is difficult and challenge your programming and problem-solving skills.
The following two parts are fun but challenging to you. The actual code to carry out the required task can be as short as 6 to 14 bytes in the object files.
Part D (10 marks)
Devise and write a LC-3 program that does not use TRAP instruction and can repeatedly write characters ¡®QA¡¯ to monitor. Please explain your logic clearly and provide the final machine code. The marks awarded will be based on the size of the code (the shortest the higher marks).
Part E (10 marks)
Devise and write a LC-3 program that can crash the LC-3 simulator. For example, you can think about a way that can continuously write something into ALL memory locations to crash the simulator. Alternatively, you can think a way to output characters to display device without synchronization. Please explain your logic clearly and provide the final machine code. The marks awarded will be based on the size of the code (the shortest the higher marks).
END OF TAKE-HOME ASSIGNMENT
4