Final Review

本Review为之前周课的补充,在阅读本Review之外,建议阅读其他周课课件。底部附aid sheet一份 浮点的表示(Floating Point) 浮点,即某小数在二进制里的表示。需注意大部分情况下,浮点存储的数据都只是对真实数字的一个approximation,譬如1/3这个无限小数是不可能用浮点准确表达的。 浮点十进制与二进制的转换(IEEE754标准) 等下补充,不想学就用计算器算:https://www.h-schmidt.net/FloatConverter/IEEE754.html 写码技巧 程序结束 如无特殊说明,任何程序结束时都需放入一个无限循环 END: MOV PC, END(不建议,理由见“三种方法将某地址放入某register”。假如这是个很大的程序,这一行码会在地址257出现,即END代表257这个地址,compile时会发生什么?) END: B END (简单易用) (Q: 不然会发生什么?A: “Instruction fetched from a location outside of a code section (.text or .exceptions).”每个程序都由不同的segment组成。在每一个可执行程序ELF里,都有header说明各segment开始和结束的地址。当一个非.text的地址进入了PC,debugger就会报以上错。 各segment的定义 ) 三种方法将某个地址放入某register MOV R0, #0x10 (不建议)墙裂不建议使用MOV指令对大于一个byte (8 binary bits) 的数字进行操作,大部分情况下都会有compile-time error跟你说这个数字不能被encode到机械码(opcode)里 同时使用MOVT 和MOVW (Monitor Program的compiler默认的方法)MOVT意为MOV Top,能将某小于16 Read more…

DE1-SoC Hardware

General Interrupt Controller Polling: keep waiting, waste of resources Interrupt: keep doing other things until interruption Manual:ftp://192.198.164.82/pub/fpgaup/pub/Intel_Material/15.0/Tutorials/Using_GIC.pdf ICCICR: must be set to 1 so that interrupt can happen ICCPMR: priority: 0 has the highest priority;Only if the hardware has a priority level higher than ICCPMR, this interrupt would be triggered. Read more…