reorganize everything

This commit is contained in:
Dennis Gunia
2024-06-24 20:38:02 +02:00
parent ea1069e59c
commit 1ed6034d99
3867 changed files with 16188 additions and 13447 deletions

View File

@@ -0,0 +1,267 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en-GB" lang="en-GB">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Features of the STM8 Simulator</title>
</head>
<body>
<h1>Features of the STM8 Simulator</h1>
<h2>Cycle Counts</h2>
Instruction timings are correct and take into account pipeline overlaps
and stall cycles. The only known exceptions are HALT, WFI and WFE which
are either not yet implemented or, in the case of HALT, only partially
and minimally implemented.
<h3>Notes on Documention</h3>
<h4>PM0044 Section 5.3 Pipelined execution examples</h4>
<p>There are some errors in these tables. See the trace outputs in the
<a href="#exanal">Example Analyses</a> section below for details.</p>
<h4>PM0044 Section 7.4 Instruction Set</h4>
<p>The cycle counts shown for instructions in PM0044 section 7 are one less
than the actual counts because the first decode cycle of an instruction
normally overlaps with the last execution cycle of the preceding
instruction.</p>
<h3>Stall Cycle Detection</h3>
<p>Error/warning event reporting of stall cycles is available should timings
be important in your application.
<pre>0&gt; <font color="#118811">show error</font>
Error: non-classified [on/ON]
[...]
Error: stm8 [off/OFF]
Warning: pipeline [unset/OFF]
Warning: decode_stall [unset/OFF]
Warning: fetch_stall [unset/OFF]
[...]</pre>
<p>These are off by default but may be enabled as required either as a group:
<pre>0&gt; <font color="#118811">set error pipeline</font></pre>
or individually:
<pre>0&gt; <font color="#118811">set error decode_stall on</font>
0&gt; <font color="#118811">set error fetch_stall on</font></pre>
</p>
<h3>Cycle and Pipeline Analysis</h3>
<p>The simulator is able to generate detailed analyses of execution showing timings
for each instruction executed including pipeline overlaps and stalls. This is controlled
via the <em>pipetrace</em> feature of the STM8 CPU module. The output is in the form
of a self-contained HTML document that can be opened with a browser or imported into
other application documentation.</p>
<p>To generate a pipeline analysis:</p>
<ul>
<li>Set the title for the next pipetrace to be opened.
<pre>0&gt; <font color="#118811">set hw cpu pipetrace title "..."</font></pre>
</li>
<li>Replace the embedded default styling with a stylesheet link to the given URL.
<pre>0&gt; <font color="#118811">set hw cpu pipetrace style "<i>url</i>"</font></pre>
</li>
<li>Open the given file, write the header (including title and stylesheet) and
continue writing the pipeline analysis as instructions are executed.
<pre>0&gt; <font color="#118811">set hw cpu pipetrace start "<i>path</i>"</font></pre>
</li>
<li>Set folding of the analysis on (the default) or off. Folding causes the cycle
count to be reset to zero (moving the output back to the left) after every
pipeline flush (i.e. after every branch, jump or call). It is recommended you
leave this on unless you have <em>very</em> wide paper or are single stepping
and annotating the analysis between steps.
<pre>0&gt; <font color="#118811">set hw cpu pipetrace fold [on|off]</font></pre>
</li>
<li>Pause writing the pipeline analysis. The output file remains open but nothing
will be written to as instructions are executed.
<pre>0&gt; <font color="#118811">set hw cpu pipetrace pause</font></pre>
</li>
<li>Insert the given text into the current pipeline analysis. The text is
inserted verbatim and may contain HTML markup. If the output is not
paused the cycle count for the analysis is set back to zero so that the
next instruction output will be moved back to the left (the first cycle
after the inserted text does however overlap the last cycle before the
inserted text as normal).
<pre>0&gt; <font color="#118811">set hw cpu pipetrace data "<i>text</i>"</font></pre>
</li>
<li>Resume a paused pipeline analysis. Instruction execution will update the
analysis output again. Resuming a paused analysis resets the cycle count
to zero so that the next instruction output is moved back to the left.
(The next cycle may or may not overlap the last cycle before the pause
depending on whether or not any instructions were executed while the
output was paused.)
<pre>0&gt; <font color="#118811">set hw cpu pipetrace resume</font></pre>
</li>
<li>Stop the pipeline analysis and close the output file. No further analysis will
occur until a new analysis file is started.
<pre>0&gt; <font color="#118811">set hw cpu pipetrace stop</font></pre>
</li>
</ul>
<a name="exanal"></a>
<h3>Example Analyses</h3>
<h4>Documented Examples</h4>
<p>These are taken from the examples in ST's &ldquo;PM0044 Programming Manual&rdquo;
section &ldquo;5.3 Pipelined execution examples&rdquo; and are generated by
the test <a href="test.asm">stm8.src/test/stm8-cycles/test.asm</a>
using the &ldquo;pipetrace&rdquo;functionality described above.</p>
<p>Note that there are some errors in the examples in section 5.3. These are noted in
the output below and the differences confirmed on HW.</p>
<ul>
<li><a href="test.table3.html">
PM0044 5.4 Table 3. Example with exact number of cycles
</a>
<li><a href="test.table6.html">
PM0044 5.4.1 Table 8. Optimized pipeline example - execution from Flash
</a>
<li><a href="test.table8.html">
PM0044 5.4.2 Table 6. Optimized pipeline example - execution from RAM
</a>
<li><a href="test.table10.html">
PM0044 5.4.3 Table 10. Pipeline with Call/Jump
</a>
<li><a href="test.table12.html">
PM0044 5.4.4 Table 12. Example of stalled pipeline
</a>
</ul>
<h4>Additional Examples</h4>
<p>The DIV instruction is special in that it takes a variable number of cycles and
is interruptible.</p>
<ul>
<li><a href="test.div.html">
Examples of DIV execution
</a>
<li><a href="test.int_div.html">
Examples of interrupted DIV execution
</a> (not currently implemented)
</ul>
<p>Other instructions, each run individually starting from an empty pipeline and
showing the overlap with the following instruction.</p>
<ul>
<li><a href="test.instrs.html">
Examples of individual instruction execution
</a>
</ul>
<h3>Hardware Cycle Counting</h3>
<p>Actual cycle counts may be obtained from hardware for comparison using a combination
of <a href="https://stm8-binutils-gdb.sourceforge.io">stm8-gdb</a>, openocd and an STLink
or other openocd/SWIM compatible debugger. Set the master and CPU clocks to be equivalent
and use one of the target's timers to count cycles.</p>
<p>For instance:</p>
<blockquote><pre>
$ openocd -f interface/stlink.cfg -f target/stm8s003.cfg &amp;
$ stm8-gdb
[...]
(gdb) target extended-remote :3333
(gdb) set $DM_CSR2 = 0x7f99
(gdb) set $DM_ENFCTR = 0x7f9a
(gdb) set $CLK_CKDIVR = 0x50c6
(gdb) set $CLK_PCKENR1 = 0x50c7
(gdb) set $TIM2_CR1 = 0x5300
(gdb) set $TIM2_EGR = 0x5306
(gdb) set $TIM2_CNTRH = 0x530c
(gdb) set $TIM2_CNTRL = 0x530d
(gdb) set $TIM2_PSCR = 0x530e
(gdb) define cycles
dont-repeat
# Freeze TIM2 when CPU is stalled by DM
set {unsigned char}$DM_ENFCTR = 0xfd
# Set HSIDIV = 0, CPUDIV = 0
set {unsigned char}$CLK_CKDIVR = 0x00
# Set TIM2 prescalar to 0 so f_CK_CNT matches f_MASTER (and hence f_CPU)
set {unsigned char}$TIM2_PSCR = 0x00
# Clear count and update config
set {unsigned char}$TIM2_EGR = 1
set {unsigned char}$TIM2_CNTRH = 0xff
set {unsigned char}$TIM2_CNTRL = 0xff
# Enable counter
set {unsigned char}$TIM2_CR1 = 0x01
# Enable clock gate
set {unsigned char}$CLK_PCKENR1 = 0x20
# Set PC
# N.B. Do not attempt to flush the decoder by writing to DM_CSR2. It upsets
# openocd which is then unable to set breakpoints.
set $pc = $arg0
#set {unsigned char}$DM_CSR2 = 0x81
# Set a HW breakpoint, run, then clear
monitor bp $arg1 1 hw
cont
monitor rbp $arg1
set $_tmp = {unsigned short}$TIM2_CNTR
disass/r $arg0,$arg1
printf "%u cycles\n", $_tmp
end
(gdb) document cycles
Set PC to the first address, set a HW break at the second address,
run and report how many cycles (as reported by $TIM2_CNTR) it took.
The target is assumed to be halted initially.
end
(gdb) monitor reset halt
target halted due to debug-request, pc: 0x00008000
(gdb) x/3i 0x811c
0x811c: ldw X,#0xfc00 ;0xfc00
0x811f: ld A,#0x80 ;0x80
0x8121: div X,A
(gdb) cycles 0x811c 0x8122
target halted due to debug-request, pc: 0x00008000
breakpoint set at 0x00008122
Program received signal SIGTRAP, Trace/breakpoint trap.
0x00008122 in ?? ()
Dump of assembler code from 0x811c to 0x8122:
0x0000811c: ae fc 00 ldw X,#0xfc00 ;0xfc00
0x0000811f: a6 80 ld A,#0x80 ;0x80
0x00008121: 62 div X,A
End of assembler dump.
14 cycles
</pre></blockquote>
<p>Don't forget that there will be an initial pipeline fetch cycle
before the first instruction can be decoded, there may be stall
cycles, multiple instructions (mostly) overlap by one cycle (which is
assumed in the timings given by PM0044), and you may have interrupts
that should be disabled.</p>
</body>
</html>

View File

@@ -0,0 +1,484 @@
; For an STM8S003
TIM4_CR1 =: 0x5340
TIM4_IER =: 0x5343
TIM4_EGR =: 0x5345
TIM4_ARR =: 0x5348
.macro codebndry
.$.end =: .
.bndry 4
.$.diff =: . - .$.end
. = . - .$.diff
.rept .$.diff
nop
.endm
.endm
.macro areabndry n
.$.end =: .
.bndry n
.ifne . - .$.end
. = . - 1
.byte 0
.endif
.endm
.area _CODE (REL,CON)
int reset
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
int no_action
no_action:
iret
codebndry
.area INITIALIZER (REL,CON)
.area CODE (REL,CON)
codebndry
reset:
; PM0044 5.4 Conventions, table 3
; N.B. PM004 cannot be right. Table 3 disagrees with the section 7 documentation for ADDW.
; Table 4 has cycle counts for ADDW that disagree with the time graph on the right.
jra table3
codebndry
table3: ldw x,[0x50]
addw x,#20
ld a,[0x30]
table3_end:
; PM0044 5.4.1 Optimized pipeline example, table 6
; N.B. Table 6 has the final F3 load one cycle too early surely?
jra table6
codebndry
table6: neg a
xor a, 0x10
ld a, #20
sub a, 0x1000
inc a
ld xl, a
srl a
swap a
sla 0x15
cp a, #0xfe
mov 0x100, #11
mov 0x101, #22
table6_end:
; PM0044 5.4.2 Optimize pipeline example - execution from RAM, table 8 (requires copy to RAM)
table8_copy:
ldw x, #table8_end - table8_start
jreq table8_copy_end
table8_copy_loop:
ld a, (table8_start - 1, x)
ld (0x100 - 1, x), a
decw x
jrne table8_copy_loop
table8_copy_end:
call 0x100
codebndry
.area INITIALIZER
codebndry
table8_start:
jra table8
codebndry
table8: neg a
xor a, 0x10
ld a, #20
sub a, 0x1000
inc a
ld xl, a
srl a
swap a
sla 0x15
cp a, #0xfe
ret
table8_end:
codebndry
.area CODE
codebndry
; PM0044 5.4.3 Pipeline with Call/Jump, table 10
jra table10
codebndry
table10:
inc a
jp label
ldw x, [0x5432]
label: neg a
call label2
ldw x, [0x5432]
ldw x, [0x7895]
label2: incw x
table10_end:
; PM0044 5.4.4 Pipeline stalled, table 12
clr a
ld 0x10, a
ld 0x20, a ; Table 12 doesn't include any setup...
jra table12
codebndry
table12:
sub sp, #20
ld a, #20
btjt 0x10, #5, to ; Table 12 assumes not taken
inc a
btjf 0x20, #3, to ; Table 12 assumes taken
nop
ldw x, [0x5432]
ldw x, [0x1234]
to: incw y
ld a, (x)
table12_end:
; DIV tests - available ST docs simply say "2-17 cycles"
.macro timed_div dividend divisor ?aligned
jra aligned
codebndry
aligned:
ldw x, #dividend
ld a, #divisor
div x, a
end_'aligned:
.endm
timed_div 0x8000,0x80
timed_div 0x8000,0x40
timed_div 0x8000,0x20
timed_div 0x8000,0x10
timed_div 0x8000,0x08
timed_div 0x8000,0x04
timed_div 0x8000,0x02
timed_div 0x8000,0x01
timed_div 0x8000,0x80
timed_div 0x4000,0x80
timed_div 0x2000,0x80
timed_div 0x1000,0x80
timed_div 0x0800,0x80
timed_div 0x0400,0x80
timed_div 0x0200,0x80
timed_div 0x0100,0x80
timed_div 0x0080,0x80
timed_div 0x0040,0x80
timed_div 0x0020,0x80
timed_div 0x0010,0x80
timed_div 0x0008,0x80
timed_div 0x0004,0x80
timed_div 0x0002,0x80
timed_div 0x0001,0x80
timed_div 0x0000,0x80
timed_div 63, 8
timed_div 64, 8
timed_div 65, 8
.macro timed_divw dividend divisor ?aligned
jra aligned
codebndry
aligned:
ldw x, #dividend
ldw y, #divisor
divw x, y
end_'aligned:
.endm
timed_divw 0x8000, 1
; Interrupted div
jra test_idiv
codebndry
test_idiv:
bset TIM4_IER, #0
bset TIM4_EGR, #0
mov TIM4_ARR, #8
ldw x, #255
ld a, #10
mov TIM4_CR1, #0x0f
div x, a
; Exercising all code in stm8.cc + inst.cc
.macro timed_op op operand1 operand2a operand2b ?aligned
jra aligned
codebndry
aligned:
.narg .narg
.ifeq .narg - 4
op operand1,operand2a,operand2b
.else
.ifeq .narg - 3
op operand1,operand2a
.else
.ifeq .narg - 2
op operand1
.else
op
.endif
.endif
.endif
end_'aligned:
.endm
; a, shortmem, longmem,
; (X), (shortoff,X), (longoff,X)
; (Y), (shortoff,Y), (longoff,Y)
; (shortoff,SP)
; ([shortptr.w],X), ([longptr.w],X)
; ([shortptr.w],X), ([longptr.w],X)
; ([shortptr.w],Y)
.macro timed_class_1 op
timed_op op a
timed_op op 0xf5
timed_op op 0xf5c2
.irp reg,X,Y
timed_op op (reg)
timed_op op (0xf5,reg)
timed_op op (0xf5c2,reg)
.endm
timed_op op (0xf5,SP)
timed_op op [0xf5]
timed_op op [0xf5c2]
timed_op op ([0xf5],X)
timed_op op ([0xf5c2],X)
timed_op op ([0xf5],Y)
.endm
; a <- #byte, shortmem, longmem,
; (X), (shortoff,X), (longoff,X)
; (Y), (shortoff,Y), (longoff,Y)
; (shortoff,SP)
; ([shortptr.w],X), ([longptr.w],X)
; ([shortptr.w],X), ([longptr.w],X)
; ([shortptr.w],Y)
.macro timed_class_2 op
timed_op op a,#0x55
timed_op op a,0x10
timed_op op a,0x1000
.irp reg,X,Y
timed_op op a,(reg)
timed_op op a,(0x10,reg)
timed_op op a,(0x1000,reg)
.endm
timed_op op a,(0x10,SP)
timed_op op a,[0x10]
timed_op op a,[0x1000]
timed_op op a,([0x10],X)
timed_op op a,([0x1000],X)
timed_op op a,([0x10],Y)
.endm
; SP <- #byte
.macro timed_class_sp_imm op
timed_op op sp,#0x55
.endm
; X, Y
.macro timed_class_xy op
timed_op op X
timed_op op Y
.endm
; Bit addressed
.macro timed_class_bit op
timed_op op 0x1000,#2
.endm
; Inherent
.macro timed_class_inh op
timed_op op
.endm
timed_class_2 adc
timed_class_2 add
timed_op addw X,#0x1000
timed_op addw X,0x1000
timed_op addw X,(0x10,SP)
timed_op addw Y,#0x1000
timed_op addw Y,0x1000
timed_op addw Y,(0x10,SP)
timed_class_sp_imm addw
timed_class_2 and
timed_class_bit bccm
timed_class_2 bcp
timed_class_bit bcpl
;break
timed_class_bit bres
timed_class_bit bset
;btjf - covered by table 12 above
;btjt - covered by table 12 above
;call - uses common fetchea code
;callf
;callr
timed_class_inh ccf
timed_class_1 clr
timed_class_xy clrw
timed_class_2 cp
timed_op cpw X,#0x55
timed_op cpw X,0x10
timed_op cpw X,0x1000
timed_op cpw X,(Y)
timed_op cpw X,(0x10,Y)
timed_op cpw X,(0x1000,Y)
timed_op cpw X,(0x10,SP)
timed_op cpw X,[0x10]
timed_op cpw X,[0x1000]
timed_op cpw X,([0x10],Y)
timed_op cpw Y,([0x1000],X)
timed_class_1 cpl
timed_class_xy cplw
timed_class_1 dec
timed_class_xy decw
; ;div - covered above
; ;divw - covered above
timed_op exg a,xl
timed_op exg a,yl
timed_op exg a,0x1000
timed_op exgw x,y
;halt
timed_class_1 inc
timed_class_xy incw
;int
;iret
;jp -covered by table 10 above
;jpf
;jra
;jrxx
timed_class_2 ld
timed_op ld 0x10,a
timed_op ld 0x1000,a
timed_op ld (X),a
timed_op ld (0x10,X),a
timed_op ld (0x1000,X),a
timed_op ld (Y),a
timed_op ld (0x10,Y),a
timed_op ld (0x1000,Y),a
timed_op ld (0x10,SP),a
timed_op ld [0x10],a
timed_op ld [0x1000],a
timed_op ld ([0x10],X),a
timed_op ld ([0x1000],X),a
timed_op ld ([0x10],Y),a
timed_op ldf a,0x500000
timed_op ldf a,(0x500000,X)
timed_op ldf a,(0x500000,Y)
timed_op ldf a,([0x5000],X)
timed_op ldf a,([0x5000],Y)
timed_op ldf a,[0x5000]
timed_op ldw X,#0x55
timed_op ldw X,0x10
timed_op ldw X,0x1000
timed_op ldw X,(X)
timed_op ldw X,(0x10,X)
timed_op ldw X,(0x1000,X)
timed_op ldw X,(0x10,SP)
timed_op ldw X,[0x10]
timed_op ldw X,[0x1000]
timed_op ldw X,([0x10],X)
timed_op ldw X,([0x1000],X)
timed_op mov 0x8000,#0xAA
timed_op mov 0x80,0x10
timed_op mov 0x8000,0x1000
timed_op mul x,a
timed_class_1 neg
timed_class_xy negw
timed_op nop
timed_class_2 or
;pop
;popw
;push
;pushw
timed_class_inh rcf
;ret
;retf
; timed_class_inh rim
timed_class_1 rlc
timed_class_xy rlcw
timed_class_xy rlwa
timed_class_1 rrc
timed_class_xy rrcw
timed_class_xy rrwa
timed_class_inh rvf
timed_class_2 sbc
timed_class_inh scf
; timed_class_inh sim
timed_op subw X,#0x5500
timed_op subw X,0x1000
timed_op subw X,(0x10,SP)
timed_op ldw Y,X
timed_op ldw 0x10,X
timed_op ldw 0x1000,X
timed_op ldw (X),Y
timed_op ldw (0x10,X),Y
timed_op ldw (0x1000,X),Y
timed_op ldw (0x10,SP),X
timed_op ldw [0x10],X
timed_op ldw [0x1000],X
timed_op ldw ([0x10],X),Y
timed_op ldw ([0x1000],X),Y
timed_class_1 sla
timed_class_xy slaw
timed_class_1 sll
timed_class_xy sllw
timed_class_1 sra
timed_class_xy sraw
timed_class_1 srl
timed_class_xy srlw
timed_class_2 sub
timed_class_sp_imm sub
timed_class_1 swap
timed_class_xy swapw
timed_class_1 tnz
timed_class_xy tnzw
;trap
;wfe
;wfi
timed_class_2 xor
dividend = 0x8000
.rept 15
timed_div dividend,0x02
dividend = dividend >> 1
.endm
dividend = 0x10000
.rept 15
timed_div dividend-1,0x02
dividend = dividend >> 1
.endm
timed_div 0x2000 0x02
timed_div 0x2040 0x02
timed_div 0x2048 0x02
timed_div 0x2148 0x02
timed_div 0x21c8 0x02
timed_div 45831 94
end:
halt
.area _DATA

View File

@@ -0,0 +1,473 @@
<html>
<head>
<title>DIV tests - available ST docs simply say '2-17 cycles'</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>DIV tests - available ST docs simply say '2-17 cycles'</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<p>The stated cycle count would seem to imply binary long division and
this is how the STM8 emulator in ucsim currently treats div for.
cycle counting. However the cycles measured on actual hardware
suggest this is not correct.
</p>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08100</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08103</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08105</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08108</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0810b</td><td class="instr">ld A,#0x40</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0810d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08110</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08113</td><td class="instr">ld A,#0x20</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08115</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08118</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0811b</td><td class="instr">ld A,#0x10</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0811d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08120</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08123</td><td class="instr">ld A,#0x08</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08125</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08128</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0812b</td><td class="instr">ld A,#0x04</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0812d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08130</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08133</td><td class="instr">ld A,#0x02</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08135</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08138</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0813b</td><td class="instr">ld A,#0x01</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0813d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08140</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08143</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08145</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08148</td><td class="instr">ldw X,#0x4000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0814b</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0814d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08150</td><td class="instr">ldw X,#0x2000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08153</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08155</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08158</td><td class="instr">ldw X,#0x1000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0815b</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0815d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08160</td><td class="instr">ldw X,#0x0800</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08163</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08165</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08168</td><td class="instr">ldw X,#0x0400</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0816b</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0816d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08170</td><td class="instr">ldw X,#0x0200</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08173</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08175</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08178</td><td class="instr">ldw X,#0x0100</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0817b</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0817d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08180</td><td class="instr">ldw X,#0x0080</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08183</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08185</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08188</td><td class="instr">ldw X,#0x0040</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0818b</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0818d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08190</td><td class="instr">ldw X,#0x0020</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08193</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08195</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08198</td><td class="instr">ldw X,#0x0010</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0819b</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0819d</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081a0</td><td class="instr">ldw X,#0x0008</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081a3</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081a5</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081a8</td><td class="instr">ldw X,#0x0004</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081ab</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081ad</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081b0</td><td class="instr">ldw X,#0x0002</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081b3</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081b5</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081b8</td><td class="instr">ldw X,#0x0001</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081bb</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081bd</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081c0</td><td class="instr">ldw X,#0x0000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081c3</td><td class="instr">ld A,#0x80</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081c5</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081c8</td><td class="instr">ldw X,#0x003f</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081cb</td><td class="instr">ld A,#0x08</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081cd</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th><th class="n">9</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081d0</td><td class="instr">ldw X,#0x0040</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081d3</td><td class="instr">ld A,#0x08</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081d5</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081d8</td><td class="instr">ldw X,#0x0041</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081db</td><td class="instr">ld A,#0x08</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081dd</td><td class="instr">div X,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th>
</thead>
</table>
</a>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x081e0</td><td class="instr">ldw X,#0x8000</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x081e3</td><td class="instr">ldw Y,#0x0001</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E"></td><td class=" E" /></tr>
<tr><td>0x081e7</td><td class="instr">divw X,Y</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th>
</thead>
</table>
</a>
</body>
</html>

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,74 @@
<html>
<head>
<title>Interrupted div</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>Interrupted div</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<p>(Not currently implemented.)</p>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td>0x08201</td><td class="instr">div X,A</td><td class=" D"></td><td class=" E"></td><td class=" E"></td><td class=" E"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th>
</thead>
</table>
</a>
</body>
</html>

View File

@@ -0,0 +1,92 @@
<html>
<head>
<title>PM0044 5.4.3 Pipeline with Call/Jump, table 10</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>PM0044 5.4.3 Pipeline with Call/Jump, table 10</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<p>PM0044 table 10 shows a fetch stall in the first execution cycle
of the call (cycle 7) however it should be possible for a fetch
to take place since pushing the return address only busies the
data bus (and STM8 is a Harvard architecture with unified address
space so the data and program are separate buses).</p>
<p>Also note that since the flush happens on the last execute cycle
of the call (unlike the jp) there is no overlap and we mark
the following cycle as a decode stall. Technically this is correct
but table 10 does not and says the call takes 3 cycles which
ignores the unavoidable stall cycle. The later instruction documentation
for call says it takes 4 cycles which is presumed to include the
stall cycle that follows it.</p>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x080c4</td><td class="instr">inc A</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080c5</td><td class="instr">jp 0x80cc</td><td class="" /><td class="" /><td class=" D X"></td><td class=" E" /></tr>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x080cc</td><td class="instr">neg A</td><td class="" /><td class="" /><td class="" /><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080cd</td><td class="instr">call 0x80d8</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E"><span class="F" /></td><td class=" E X" /></tr>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x080d8</td><td class="instr">incw X</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=""></td><td class=" D Sfetch"><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th><th class="n">9</th><th class="n">10</th><th class="n">11</th>
</thead>
</table>
</a>
</body>
</html>

View File

@@ -0,0 +1,94 @@
<html>
<head>
<title>PM0044 5.4.4 Pipeline stalled, table 12</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>PM0044 5.4.4 Pipeline stalled, table 12</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<h2>Errata</h2>
<ul>
<li>Table 12 shows the BTJT as taking 1 decode, 2 execute cycles but the
later documention for the instruction implies the second execution
cycle is only used if the branch is taken - and this isn't.
</li>
<li>Table 12 has a jump in time (cycles) from 4 straight to 7.
</li>
<li>The last instruction is shown one cycle early in table 12. The decode stall
should line up with the execution cycle of the previous instruction
as the description above the table says.
</li>
</ul>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x080e0</td><td class="instr">sub SP,#0x14</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080e2</td><td class="instr">ld A,#0x14</td><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080e4</td><td class="instr">btjt 0x0010,#5,0x80f8</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080e9</td><td class="instr">inc A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080ea</td><td class="instr">btjf 0x0020,#3,0x80f8</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E X"></td><td class=" E" /></tr>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x080f8</td><td class="instr">incw Y</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080fa</td><td class="instr">ld A,(X)</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D Sraw"><span class="F" /></td><td class=" D"></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th><th class="n">9</th><th class="n">10</th><th class="n">11</th><th class="n">12</th>
</thead>
</table>
</a>
</body>
</html>

View File

@@ -0,0 +1,88 @@
<html>
<head>
<title>PM0044 5.4 Conventions, table 3</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>PM0044 5.4 Conventions, table 3</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<h2>Errata</h2>
<ul>
<li>The LDW shown in PM0044 table 3 is missing a decode cycle.
<br/>
(Confirmed on HW)
</li>
<li>The ADDW shown in PM0044 table 3 has one too many decode cycles.
<br/>
(Confirmed on HW)
</li>
<li>The LD shown in PM0044 table 3 is missing a decode cycle.
</ul>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x0808c</td><td class="instr">ldw X,[0x50.w]</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" D"></td><td class=" D"></td><td class=" D"></td><td class=" E" /></tr>
<tr><td>0x0808f</td><td class="instr">addw X,#0x0014</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E"></td><td class=" E" /></tr>
<tr><td>0x08092</td><td class="instr">ld A,[0x30.w]</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" D"></td><td class=" D"></td><td class=" D"><span class="FS" /></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th><th class="n">9</th><th class="n">10</th><th class="n">11</th><th class="n">12</th><th class="n">13</th>
</thead>
</table>
</a>
</body>
</html>

View File

@@ -0,0 +1,85 @@
<html>
<head>
<title>PM0044 5.4.1 Optimized pipeline example - execution from flash, table 6</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>PM0044 5.4.1 Optimized pipeline example - execution from flash, table 6</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x08098</td><td class="instr">neg A</td><td class=""><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x08099</td><td class="instr">xor A,0x10</td><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0809b</td><td class="instr">ld A,#0x14</td><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0809d</td><td class="instr">sub A,0x1000</td><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080a0</td><td class="instr">inc A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E" /></tr>
<tr><td>0x080a1</td><td class="instr">ld XL,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E" /></tr>
<tr><td>0x080a2</td><td class="instr">srl A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E" /></tr>
<tr><td>0x080a3</td><td class="instr">swap A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080a4</td><td class="instr">sla 0x15</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"></td><td class=" E" /></tr>
<tr><td>0x080a6</td><td class="instr">cp A,#0xfe</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080a8</td><td class="instr">mov 0x0100,#0x0b</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x080ac</td><td class="instr">mov 0x0101,#0x16</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th><th class="n">9</th><th class="n">10</th><th class="n">11</th><th class="n">12</th><th class="n">13</th><th class="n">14</th>
</thead>
</table>
</a>
</body>
</html>

View File

@@ -0,0 +1,83 @@
<html>
<head>
<title>PM0044 5.4.2 Optimize pipeline example - execution from RAM, table 8</title>
<script>
function toggle(id) {
var obj = document.getElementById(id);
if (obj.style.display === 'none')
obj.style.display = 'block';
else
obj.style.display = 'none';
}
</script>
<style>
.pipetrace { margin: 1em 0; }
.pipetrace, .pipetrace td { border: 1px solid black; border-collapse: collapse; padding: 0 0.2em; white-space: nowrap; }
.pipetrace thead { background-color: #d2d2d2; position: sticky; top: 0; }
.pipetrace thead th { border: none; box-shadow: inset -1px -1px #000; }
.pipetrace tr:nth-child(even) { background-color: #f2f2f2; }
.pipetrace td { min-width: 1.6em; }
.pipetrace td.instr:before { content: ""; }
.pipetrace td.instr { width: 9.5em; }
.pipetrace td.Sbus:before { content: " S₀"; }
.pipetrace td.Sfetch:before { content: " S₁"; }
.pipetrace td.Sraw:before { content: " S₂"; }
.pipetrace td:before { content: attr(class); }
.pipetrace td.D { background-color: lawngreen; }
.pipetrace td.E { background-color: navajowhite; }
.pipetrace td.Sbus { background-color: red; }
.pipetrace td.Sfetch { background-color: red; }
.pipetrace td.Sraw { background-color: red; }
.pipetrace td.X, .pipetrace td.Flushed { background-color: red; }
.pipetrace td span:after { content: attr(class); }
.pipetrace td span { padding: 0 0.2em; margin: 0 0 0 0.1em; }
.pipetrace td span.FS { background-color: lightgrey; }
.pipetrace td span.F { background-color: lightskyblue; }
#pipetrace_legend { border: none; background-color: white; position: fixed; bottom: 0; right: 0; }
#pipetrace_legend tr:first-of-type { font-weight: bold; }
#pipetrace_legend td { text-align: center; }
#pipetrace_legend td.defn { text-align: left; }
#pipetrace_legend td.defn:before { content: ""; }
</style>
</head>
<body onload="toggle('pipetrace_legend')">
<h1>PM0044 5.4.2 Optimize pipeline example - execution from RAM, table 8</h1>
<table id="pipetrace_legend" class="pipetrace">
<tr><td colspan="2">Legend</td></tr>
<tr><td class="D" /><td class="defn">Decode</td></tr>
<tr><td class="E" /><td class="defn">Execute</td></tr>
<tr><td><span class="F" /></td><td class="defn">Fetch</td></tr>
<tr><td class="X" /><td class="defn">Flush</td></tr>
<tr><td><span class="FS" /></td><td class="defn">Fetch Stall - space in prefetch buffer but bus busy</td></tr>
<tr><td class="Sbus" /><td class="defn">Decode Stall - bus busy</td></tr>
<tr><td class="Sfetch" /><td class="defn">Decode Stall - insufficient data in prefetch buffer</td></tr>
<tr><td class="Sraw" /><td class="defn">Decode Stall - read after write</td></tr>
</table>
<a title="Click for legend">
<table class="pipetrace" onclick="toggle('pipetrace_legend')">
<tbody>
<tr><td /><td class="Flushed" /></tr>
<tr><td>0x00104</td><td class="instr">neg A</td><td class=""><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x00105</td><td class="instr">xor A,0x10</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="FS" /></td><td class=" E" /></tr>
<tr><td>0x00107</td><td class="instr">ld A,#0x14</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D Sfetch"><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x00109</td><td class="instr">sub A,0x1000</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="FS" /></td><td class=" E" /></tr>
<tr><td>0x0010c</td><td class="instr">inc A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D Sfetch"><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D Sfetch"><span class="F" /></td><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0010d</td><td class="instr">ld XL,A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0010e</td><td class="instr">srl A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x0010f</td><td class="instr">swap A</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="F" /></td><td class=" E" /></tr>
<tr><td>0x00110</td><td class="instr">sla 0x15</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="FS" /></td><td class=" E" /></tr>
<tr><td>0x00112</td><td class="instr">cp A,#0xfe</td><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class="" /><td class=" D"><span class="FS" /></td><td class=" E" /></tr>
</tbody>
<thead>
<tr><th>Address</th><th>Instruction</th><th class="n">1</th><th class="n">2</th><th class="n">3</th><th class="n">4</th><th class="n">5</th><th class="n">6</th><th class="n">7</th><th class="n">8</th><th class="n">9</th><th class="n">10</th><th class="n">11</th><th class="n">12</th><th class="n">13</th><th class="n">14</th><th class="n">15</th><th class="n">16</th><th class="n">17</th><th class="n">18</th><th class="n">19</th><th class="n">20</th><th class="n">21</th>
</thead>
</table>
</a>
</body>
</html>