Week#1 開發記錄

+課程學習筆記

加法器的設計邏輯
  1. 做出真值表
  1. 用卡諾圖得出輸入輸出關係:S=A⊕B,CO =A.B
  1. 對應到邏輯電路:
  • 同理可得全加器
數字背後的道理
  • Single-precision floating-point format:
  • 一個搞笑的人為造成integer overflow的例子
Introduction to ARM Architecture
  • Arm Processor modes
  • User: normal program execution mode
  • FIQ: used for handling a high priority (fast) interrupt
  • IRQ: used for handling a low priority (normal) interrupt
  • Supervisor: entered on reset and when SWI (software interrupt instruction) is executed
  • Abort: used for handling memory access violations
  • Undefined: used for handling undefined instructions
  • System: a privileged mode that uses the same registers as the user mode
  • ARM specific optimizations
  • Use of constants using barrel shifter:
  • Instead of 5*x, use (x<<2) + x
  • Use of conditional execution to reduce code size and execution cycles
  • Count down loops
  • Counting upwards produces ADD, CMP and B{x} instructions
  • Counting downwards produces SUBS & BGE 
  • Use 32-bit data types as much as possible
  • Avoid divisions or remainder operation (%)
  • Register accesses more efficient than memory accesses
  • Avoid register spilling (more parameters than registers end up in memory on stack)
  • Use pure functions when possible and only if they do not have side effects
 
  • 檢視了一下上學期的作業,感覺..恩,繼續做就對了
 
計算每道 ARM/Thumb 指令的 cycle count
  • 為了量測每道 ARM/Thumb 指令的 cycle count,想使用Cycle Count Register ,不過直接存取會:
  • volatile unsigned int *DWT_CYCCNT = (unsigned int *)0xE0001004; =>qemu: uncaught target signal 11 (Segmentation fault) - core dumped 
  • todo:在stm32f103上實際測試