Skip to content

Commit 64a60a0

Browse files
committed
9.26 notes
1 parent a7320b5 commit 64a60a0

File tree

5 files changed

+147
-0
lines changed

5 files changed

+147
-0
lines changed

_practice/2022-09-26.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
1. add a hardware term to your group repo. Remember to check other issues and then post an issue and self-assign it before you start working so that two people do not make the same one. Review one other PR.
2+
1. Expand on your update to `abstraction.md`: Can you reconcile different ways you have seen memory before?
3+
1. Try understanding the max.hack and rect.hack. Make notes and answer the questions below in `assemblyexplore.md`.
4+
5+
```
6+
1. Explain how max.hack works in detail.
7+
1. Write code in a high level language that would compile into this program. Try writing multiple different versions.
8+
1. What does this max.hack assume has happened that it doesn't include in its body.
9+
1. What does rect.hack do?
10+
1. What did you learn trying to figure out how it works?
11+
```

_prepare/2022-09-26.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. Bring questions about git to class on Wednesday.
2+
1. Your grading contract proposal is due Thursday at 3pm.
3+
1. Make sure that the `gh` CLI tool works by using it to create an issue called test on your kwl repo with `gh issue create`

_review/2022-09-26.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
1. Review and update your listing of how data moves through a program in your `abstraction.md`. Answer reflection questions.
2+
1. practice with the hardware simulator, try to understand its assembly language enough to modify it and walk through what other steps happen.
3+
1. Update your KWL chart with the new items and any learned items

_toc.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ parts:
2121
- file: notes/2022-09-14
2222
- file: notes/2022-09-19
2323
- file: notes/2022-09-21
24+
- file: notes/2022-09-26
2425
- caption: Activities
2526
chapters:
2627
- file: activities/kwl

notes/2022-09-26.md

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,129 @@
1+
# How do we study Computer Systems?
2+
3+
## Admin
4+
5+
- make sure you have a grading contract repo
6+
- you'll track your progress in your
7+
8+
## Systems
9+
10+
11+
## Abstraction
12+
13+
The advantage to assembly is that it is hardware independent and human readable. It is low level and limited to what the hardware *can* do, but it is a version of that that can be run on different hardware.
14+
```{warning}
15+
This is incomplete, will come back and fill in later
16+
```
17+
18+
19+
## Using the simulator
20+
21+
On MacOS:
22+
23+
```bash
24+
cd path/nand2tetris/tools
25+
bash CPUEmulator.sh
26+
```
27+
28+
On Windows:
29+
Double click on the CPUEmulator.bat file
30+
31+
32+
We're going to use the test cases from the book's project 5:
33+
34+
1. Load Program
35+
1. Navigate to nand2tetris/projects/05
36+
37+
We're not going to *do* project 5, which is to build a CPU, but instead to use the test.
38+
39+
For more on how the emulator works see the [CPU Emulator Tutorial](https://www.nand2tetris.org/_files/ugd/44046b_24b3a15aa628404fbf6dacd86d7da3af.pdf).
40+
41+
For much more detail about how this all works [chapter 4](https://www.nand2tetris.org/_files/ugd/44046b_d70026d8c1424487a451eaba3e372132.pdf) of the related text book has description of the machine code and assembly language.
42+
43+
44+
## How does the computer actually add constants?
45+
46+
We'll use add.hack first.
47+
48+
This program adds constants, 2+3.
49+
50+
It is a program, assembly code that we are loading to the simulator's ROM, which is memory that gets read only by the CPU.
51+
52+
Run the simulator and watch what each line of the program does.
53+
54+
Notice the following:
55+
- to compute with a constant, that number only exists in ROM in the instructions
56+
- to write a value to memory the address register first has to be pointed to what where in the memory the value will go, then the value can be sent there
57+
58+
59+
The simulator has a few key parts:
60+
- address register
61+
- program counter
62+
63+
If you prefer to read, see [section 5.2.1- 5.2.6 of nan2tetris book](https://www.nand2tetris.org/_files/ugd/44046b_b2cad2eea33847869b86c541683551a7.pdf)
64+
65+
- This program the first instruction puts 2 in the address register from the instructions in ROM.
66+
- Then it moves the 2 through the ALU to the data register (D)
67+
- then it puts 3 on the address register
68+
- then it adds the numbers at D and A
69+
- then it puts 0 on the address register
70+
- then it write the output from the ALU (D) to memory (at the location indicated by the A register)
71+
72+
```{admonition} Try if yourself
73+
- What line do you change to change where it outputs the data?
74+
- How could you add a third number?
75+
- How could you add two pairs, saving the intermediate numbers?
76+
- How could you do (4+4)*(3+2)?
77+
```
78+
79+
80+
81+
82+
## Hardware Overview
83+
84+
85+
```{important}
86+
Today is the first day outside of the grade free zone.
87+
```
88+
89+
## Review today's class
90+
(required for a C or better)
91+
92+
```{include} ../_review/2022-09-26.md
93+
```
94+
95+
## Prepare for Next Class
96+
(required for a C or better)
97+
98+
99+
```{include} ../_practice/2022-09-26.md
100+
```
101+
102+
```{warning}
103+
the template contracts in the repo have an error in them; use the ones on the [course website](https://introcompsys.github.io/fall2022/syllabus/contract.html).
104+
```
105+
106+
## More Practice
107+
108+
(mostly required for a B or better)
109+
110+
```{include} ../_practice/2022-09-26.md
111+
```
112+
113+
114+
115+
## Questions After Class
116+
117+
• more about the hardware architecture abstractions
118+
119+
• When requesting a review for a PR or something similar, would the only thing to do be attaching either you the professor or the teachers assistant?
120+
With our collaborative repo, would we facilitate the merges and reviews or would you need to have the last review of the information?
121+
Should we assume that when you ask to write a document, we should create a markdown file with a similar name (as opposed to an assignment with the description "add branches.md to your KWL repo")
122+
123+
• Are there other simulators that we can play with?
124+
125+
• for my grading contract if i choose to go for an A and stick with the A but don't meet the requirements how much is my grade affected
126+
127+
• how the CPU performs addition and stores the result in a memory location on the RAM
128+
129+
• Explain more levels of abstraction and how they are connected

0 commit comments

Comments
 (0)