本周作業花了不少時間才完成,因此決定寫篇筆記紀錄。
Memory
16384 -> 0100 0000 0000 0000
24576 -> 0110 0000 0000 0000
觀察可知,要區分RAM, Screen與Keyboard,可由13~14bit判斷:
00, 01 -> RAM
10 -> Screen
11 -> Keyboard
跟project3很像,先DMux分配load,之後再Mux
RAM, Screen, Keyboard的規格可以查Hack Chip Set,address根據容量大小而異。
測試時注意:
To anyone facing the same problem… on the Hardware Simulator user interface, right above where you see the script executing the tests, there are three drop down boxes. The one furthest to the right which is labeled “View” is probably currently set to “Script.” Click the drop down and select “Screen,” and you will see an interface that has a keyboard icon. Click it and then hit the corresponding key to complete the test.
CPU
這部分最困難的是自行分析c,也就是各個元件的控制訊號該怎麼生成。首先先從Mux16的c開始。我們知道instruction分為A instruction與C instruction,前者是把數字存放進A register,後者是進行運算。因此此處若為A instruction,Mux16就選擇instruction;若為C instruction,Mux16就選擇ALU output。
判斷指令直接看instruction[15]。
同理A register的c也是看instruction[15]。
writeM訊號指的是需不需要write back to memory。
D register同樣觀察表格,發現與d2有關。因此若為C instruction且d2為1,則c為1,反之為0。
第二個Mux16是要選擇A register output或者inM。A instruction選擇前者,C instruction選擇後者這點應該不難理解。這裡需要參考下圖,發現要選A還是M由a,也就是instruction[12]控制。
最後是PC。沒想法的話就回去看課程網站提供的chip API或是chip的描述:
沒有留言:
張貼留言