5.3. Examples of Simulator Use

This section contains several example of using the target Microprocessor simulator.

$ erc-coff-run hello
Hello world
$ erc-coff-run -s hello
Clock Cycles
  regular     :      1057, 88.60 %
  annulled    :        14, 1.17 %
  stalls      :       122, 10.23 %
  Total       :      1193
Instructions
  call       :         5, 0.66 %
  woverflow  :         0, 0.00 % (0.00 % of calls)
  wunderflow :         0, 0.00 % (0.00 % of calls)
  integer    :       431, 56.79 %
  load       :        59, 7.77 %
  store      :       117, 15.42 %
  branch     :       152, 20.03 %
  float      :         0, 0.00 %
  Total      :       759
Average Cycles per Instruction (CPI)
 Integer CPI  :      1.57
 Float CPI    :       nan
 Overall CPI  :      1.57
Performance
  ERC32 performance (10.0 MHz):  6.36 MOPS ( 6.36 MIPS,  0.00 MFLOPS)
  Simulated ERC32 time        :  0.12 ms
  Processor utilisation       : 100.00 %
  Real-time / simulator-time  : 1/0.00 
  Simulator performance       : 0 KIPS
  Used time (sys + user)      :   0 s

Hello world

The following example shows an instruction trace with line numbers. We have delayed the trace by 200 microseconds to skip to the lines of interest.

$ erc-coff-run -t -d 100 hello
/opt/gcc-erc32-1.2/erc-coff/src/libc/sys/write.c:89
 <write+a0>
     100.000 02002678 bcs,a   0x200263c
     100.100 0200267C ldsb  [ %o1 + %o3 ], %o5
/opt/gcc-erc32-1.2/erc-coff/src/libc/sys/write.c:93
 <write+64>
     100.300 0200263C cmp  %o5, 0xa
     100.500 02002640 bne  0x200265c
     100.600 02002644 nop 
/opt/gcc-erc32-1.2/erc-coff/src/libc/sys/write.c:100
 <write+84>
     100.700 0200265C ld  [ %o4 ], %g2
     100.900 02002660 btst  %g2, %g3
     101.100 02002664 be  0x200265c
     101.200 02002668 nop 
/opt/gcc-erc32-1.2/erc-coff/src/libc/sys/write.c:102
     101.300 0200266C st  %o5, [ %g1 ]
/opt/gcc-erc32-1.2/erc-coff/src/libc/sys/write.c:89
     101.600 02002670 inc  %o3
     101.700 02002674 cmp  %o3, %o2
     101.800 02002678 bcs,a   0x200263c
     101.900 0200267C ldsb  [ %o1 + %o3 ], %o5
...lots of output...