Skip to content

Commit ef7d526

Browse files
📝 Assignment 4 --- Create (#235)
1 parent 6199702 commit ef7d526

File tree

17 files changed

+9333
-1
lines changed

17 files changed

+9333
-1
lines changed

.github/workflows/sphinx-build.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,13 @@ jobs:
3434
- name: Install Dependencies
3535
run: |
3636
pip install .
37-
- name: Compress Assignment Files
37+
- name: Collect and Compress Assignment Files
3838
run: |
3939
zip -jr site/assignments/assignment-1/assignment_1-dig_files.zip site/assignments/assignment-1/assignment_1-dig_files
4040
zip -jr site/assignments/assignment-2/assignment_2-dig_files.zip site/assignments/assignment-2/assignment_2-dig_files
4141
zip -jr site/assignments/assignment-3/assignment_3-dig_files.zip site/assignments/assignment-3/assignment_3-dig_files
42+
cp site/topics/programming/assembler.py site/assignments/assignment-4/assignment_4-dig_files/
43+
zip -jr site/assignments/assignment-4/assignment_4-dig_files.zip site/assignments/assignment-4/assignment_4-dig_files
4244
- name: Sphinx Build
4345
run: |
4446
sphinx-build -b html site/ out/
Lines changed: 185 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,185 @@
1+
************
2+
Assignment 4
3+
************
4+
5+
* **Worth**: 5%
6+
* **DUE**: Friday April 4, 11:55pm; submitted on MOODLE.
7+
8+
9+
10+
Provided Files
11+
==============
12+
13+
Incomplete Digital, hex and esap files are provided for the questions.
14+
15+
:download:`These files can be downloaded from here. <assignment_4-dig_files.zip>`
16+
17+
Uncompress this folder and open the files as necessary. Each question specifies which of the file to work in.
18+
19+
20+
21+
Part 1 --- Machine Code
22+
=======================
23+
24+
.. note::
25+
26+
External programs can be added to RAM within Digital through **Edit -> Circuit specific settings -> Advanced**.
27+
Select the **Preload program memory at startup** checkbox and navigate and the select the desired hex file for
28+
the **Program file** field.
29+
30+
31+
#. Write a machine code program to animate ``1`` "bouncing" across the output display on repeat, as seen below
32+
33+
* For this question, use the provided "1-ESAP.dig" system for running the program
34+
* Write the machine code program in the provided "1-bounce.hex" file
35+
36+
.. figure:: bounce.gif
37+
:width: 250 px
38+
:align: center
39+
40+
Demonstration of the number ``1`` "bouncing" across the output display.
41+
42+
43+
44+
#. Create a new "bouncing" program such that the delay between each step of the animation is the same
45+
46+
* Due to jump, the time delay between the updates to the output register is likely inconsistent
47+
* Change the program such that there is an even time delay between each update
48+
* If the solution to the previous question already addressed this, simply repeat it here
49+
* For this question, use the provided "1-ESAP.dig" system for running the program
50+
* Write the machine code program in the provided "2-bounce_timing.hex" file
51+
52+
53+
#. Write a program to calculate and output the result of ``55 + 66`` and ``55 - 50``
54+
55+
* For this question, use the provided "1-ESAP.dig" system for running the program
56+
* Write the machine code program in the provided "3-arithmetic.hex" file
57+
58+
59+
60+
Part 2 --- New Instructions
61+
===========================
62+
63+
Because outputting a value requires saving it to RAM before it can be displayed (``SAVA`` + ``OUTU``, for example), it
64+
effectively takes up 2 RAM addresses. This may become problematic as the system only has 16 bytes of RAM.
65+
66+
#. Create two new instructions to output an unsigned or signed integer directly from the A register
67+
68+
* Have ``0b1011`` and ``0x1100`` be the instructions for an unsigned and signed integer respectively
69+
* These instructions take no operand
70+
* Modify the contents of the look up table in the provided "4-ESAP.dig" file to add the new instructions
71+
72+
* **Hint:** Use a script to generate the hex values for the control logic look up table
73+
74+
75+
#. Using the new instructions, calculate and output the result of ``55 + 66``, ``55 - 50``, and ``66 - 55``
76+
77+
* This must be done in a single program
78+
* Use the modified "4-ESAP.dig" file from the previous question for running the program
79+
* Write the machine code program in the provided "5-arithmetic_big.hex" file
80+
81+
82+
83+
Part 3 --- Eliminating Clock Cycles
84+
===================================
85+
86+
Currently, each instruction within the system always takes 4 microcode steps (clock cycles), even if the instruction
87+
only really needs 3. For example, consider that the ``LDAD`` instruction only needs the 2 fetch steps + 1 more step to
88+
output from the instruction register and input into the A register.
89+
90+
#. Modify the ESAP design and instruction set such that instructions complete in 3 clock cycles, where possible
91+
92+
* For this question, do not include the new output instructions from the previous part
93+
* This question requires modifying the hardware of the ESAP system and the control logic look up table
94+
* Use and modify the provided "6-ESAP.dig" file
95+
96+
* Use a script to generate the hex values for the control logic look up table
97+
98+
99+
* Although there is an argument for leaving ``NOOP`` 4 clock cycles, make it take 3 here
100+
101+
102+
103+
Part 4 --- Assembly
104+
===================
105+
106+
Writing simple programs in machine code is arguably not too difficult, but remembering machine code is a tedious task.
107+
When solving more complex problems, eliminating unnecessary difficulty helps improve the programming experience.
108+
109+
#. Write a program in the ESAP assembly language that can divide 2 numbers and output the result
110+
111+
* To simplify things, assume
112+
113+
* The numbers are evenly divisible (no remainder)
114+
* Only positive integers
115+
* The answer will always be at least ``1`` (one would not ask ``0/5``, for example)
116+
117+
118+
* Have the dividend and divisor be in addresses 14 and 15 respectively
119+
* For this question, use the provided "7-ESAP_conditions.dig" system for running the program
120+
121+
* This solution will not make use of the modified ESAP systems from the previous questions
122+
* No new instructions or 3 microcode step instructions
123+
124+
125+
* Write the assembly code program in the provided "7-divide.esap" file
126+
* Use the provided "assembler.py" to assemble to machine code
127+
128+
129+
130+
Some Hints
131+
==========
132+
133+
* Work on one part at a time
134+
* Some parts of the assignment build on the previous, so get each part working before you go on to the next one
135+
* Test each design as you build it
136+
137+
* This is a really nice thing about these circuits; you can run your design and see what happens
138+
* Mentally test before you even implement --- what does this design do? What problem is it solving?
139+
140+
141+
* If you need help, ask
142+
143+
* Drop by office hours
144+
145+
146+
147+
Some Marking Details
148+
====================
149+
150+
.. warning::
151+
152+
Just because your design produces the correct output and the tests pass, that does not necessarily mean that you
153+
will get perfect, or even that your design is correct.
154+
155+
156+
Below is a list of both *quantitative* and *qualitative* things we will look for:
157+
158+
* Correctness?
159+
* Did you follow instructions?
160+
* Label names?
161+
* Design, layout, and style?
162+
* Did you do weird things that make no sense?
163+
164+
165+
166+
What to Submit to Moodle
167+
========================
168+
169+
* Submit your modified ESAP Digital (*.dig*) files to Moodle
170+
* Submit your completed hex files for the machine code programs
171+
* Submit your completed esap file for the divide assembly program
172+
* Submit the hex files for modifying the look up tables
173+
* Do **not** compress the files before uploading to Moodle
174+
175+
176+
.. warning::
177+
178+
Verify that your submission to Moodle worked. If you submit incorrectly, you will get a 0.
179+
180+
181+
182+
Assignment FAQ
183+
==============
184+
185+
* :doc:`See the general FAQ </assignments/faq>`

0 commit comments

Comments
 (0)