Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
Next revision
Previous revision
saga:registers:saga_clock_counter [2016/05/23 13:29]
flype [Macros]
saga:registers:saga_clock_counter [2020/08/02 12:37] (current)
Line 1: Line 1:
-====== ​SAGA Clock-Cycle Register ​======+====== ​SAGA_CLOCK_COUNTER register ​====== 
 + 
 +{{:​clockcycle.png?​nolink&​64|}}
  
 ===== Overview ===== ===== Overview =====
  
-''​Clock-Cycle ​Register''​ is a new SAGA Read-Only register. It is unique feature, never seen in other 68K existing system. It allows to get, in real-time, the number of cycles consumed by one or more instructions. This register can come in handy when programmer ​need to optimize ​his code and locate greedy routines.+''​Clock-Cycle ​Counter register''​ is a new SAGA Read-Only register. It is unique feature, never seen in another ​existing ​68k system. It allows to get, in real-time, the number of cycles consumed by one or more CPU instructions. This register can come in handy when programmer ​needs to optimize ​their code and locate greedy routines. 
 + 
 +----
  
 ===== Name ===== ===== Name =====
Line 20: Line 24:
  
   * ''​32-bits''​   * ''​32-bits''​
 +
 +----
  
 ===== Description ===== ===== Description =====
Line 44: Line 50:
   DEBUG EQU 1   DEBUG EQU 1
   ​   ​
-  ​SAGA_CLKCNT ​EQU $DE0008+  ​SAGA_CLOCK_COUNTER ​EQU $DE0008
   ​   ​
-  ​CLKRESET ​MACRO+  ​CLKCNT_RESET ​MACRO
     IFNE DEBUG     IFNE DEBUG
-    tst.l SAGA_CLKCNT+    tst.l SAGA_CLOCK_COUNTER
     ENDC     ENDC
     ENDM     ENDM
   ​   ​
-  ​CLKSAVE ​MACRO+  ​CLKCNT_SAVE ​MACRO
     IFNE DEBUG     IFNE DEBUG
-    move.l ​SAGA_CLKCNT,__\1_time+    move.l ​SAGA_CLOCK_COUNTER,__\1
     ENDC     ENDC
   ENDM   ENDM
   ​   ​
-  ​CLKADD ​MACRO+  ​CLKCNT_ADD ​MACRO
     IFNE DEBUG     IFNE DEBUG
     move.l d0,-(sp)     move.l d0,-(sp)
-    move.l ​SAGA_CLKCNT,d0 +    move.l ​SAGA_CLOCK_COUNTER,d0 
-    add.l  d0,__\1_time+    add.l  d0,__\1
     move.l (sp)+,d0     move.l (sp)+,d0
     ENDC     ENDC
   ENDM   ENDM
  
-  MyRoutine: +  MyRoutine:​  
-  +    ​move.l #​$CAFECAFE,​d1 ​   ; Operand for DIVU 
-    ​CLKRESET +    ​CLKCNT_RESET ​           ​Reset the Clock-Cycle counter 
-     +    ​divu.l #​100,​d1 ​         ; Consume some CPU cycles 
-    ; Place here your routine +    ​CLKCNT_SAVE MyCounter ​  ; Save the number of cycles in MyCounter
-     +
-    ​CLKADD myCounter +
-    ​+
     RTS     RTS
 +  ​
 +  MyCounter: DC.L 0
  
 ---- ----
  
-[[start|Home]] |  +<​php>​tpl_youarehere();</​php>​ 
-[[links|Links]] |  +
-[[saga_core|SAGA]] |  +
-[[saga_registers|SAGA Registers]]+
Last modified: le 2020/08/02 12:37