Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPawel Piech2009-01-08 21:08:05 +0000
committerPawel Piech2009-01-08 21:08:05 +0000
commit5b471873662a87a77cfd854c98fca9c9948aa878 (patch)
tree3da8dcf3820bf3c2d4ebd17e4e8f3043e9773676 /dsf/org.eclipse.cdt.examples.dsf.pda/samples
parent47093064424981f85335cfdaf25368c54cd840f8 (diff)
parentc1e6da229b8ffcea160498f034bfa6bc8ff6f230 (diff)
downloadorg.eclipse.cdt-5b471873662a87a77cfd854c98fca9c9948aa878.tar.gz
org.eclipse.cdt-5b471873662a87a77cfd854c98fca9c9948aa878.tar.xz
org.eclipse.cdt-5b471873662a87a77cfd854c98fca9c9948aa878.zip
Migrated DSF and DSF-GDB to the CDT project.
Diffstat (limited to 'dsf/org.eclipse.cdt.examples.dsf.pda/samples')
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/counter.pda11
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/drop.pda12
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/example.pda35
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/fibonacci.pda32
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/registers.pda72
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/stack.pda21
-rw-r--r--dsf/org.eclipse.cdt.examples.dsf.pda/samples/structures.pda23
7 files changed, 206 insertions, 0 deletions
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/counter.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/counter.pda
new file mode 100644
index 00000000000..9b2b731006b
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/counter.pda
@@ -0,0 +1,11 @@
+push 0
+:main
+var n
+pop $n
+push $n
+push 1
+add
+dup
+push $n
+output
+branch_not_zero main \ No newline at end of file
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/drop.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/drop.pda
new file mode 100644
index 00000000000..84f60fee035
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/drop.pda
@@ -0,0 +1,12 @@
+call one
+:one
+call two
+:two
+call three
+:three
+call four
+:four
+push DONE
+output
+
+
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/example.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/example.pda
new file mode 100644
index 00000000000..a95886358c2
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/example.pda
@@ -0,0 +1,35 @@
+push "hello"
+output
+call foobar
+push 3
+:label
+dup
+push 4
+push 5
+add
+add
+output
+dec
+dup
+branch_not_zero label
+call foobar
+push "end"
+output
+halt
+:foobar
+var a
+var b
+call barfoo
+push "first"
+push "second"
+pop $a
+pop $b
+push $a
+push $b
+output
+output
+return
+:barfoo
+push "barfoo"
+output
+return
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/fibonacci.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/fibonacci.pda
new file mode 100644
index 00000000000..e39595a9811
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/fibonacci.pda
@@ -0,0 +1,32 @@
+push 6
+call fibonacci
+output
+halt
+#
+# f(n) = f(n-1) + f(n-2)
+# f(0) = 1
+# f(1) = 1
+#
+:fibonacci
+var n
+pop $n
+push $n
+branch_not_zero gt0
+push 1
+return
+:gt0
+push $n
+dec
+branch_not_zero gt1
+push 1
+return
+:gt1
+push $n
+dec
+call fibonacci
+push $n
+dec
+dec
+call fibonacci
+add
+return
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/registers.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/registers.pda
new file mode 100644
index 00000000000..97fd8d4094d
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/registers.pda
@@ -0,0 +1,72 @@
+def register $pc General true
+def register $sp General true
+def register $status General true
+def bitfield $status.BITS_00_07 0 8
+def bitfield $status.BITS_08_15 8 8
+def bitfield $status.BITS_16_23 16 8
+def bitfield $status.BITS_24_31 24 8
+def mnemonic $status.BITS_24_31 three 3
+def mnemonic $status.BITS_24_31 twelve 12
+def mnemonic $status.BITS_24_31 fourty_eight 48
+def mnemonic $status.BITS_24_31 one_nighty_two 192
+def register $stackdepth General true
+def register $stack[0] General true
+def register $stack[1] General true
+def register $stack[2] General true
+def register $stack[3] General true
+def register $stack[4] General true
+push 103
+pop $$pc
+push 306
+push 2
+pop $$sp
+push 400
+pop $$status
+push 5
+pop $$stackdepth
+push 12
+pop $$stack[0]
+push 45
+pop $$stack[1]
+push 146
+pop $$stack[2]
+push 215
+pop $$stack[3]
+push 251
+pop $$stack[4]
+push 306
+pop $$stack[5]
+def register $total-instructions Analysis false
+def register $add-instructions Analysis false
+def register $call-instructions Analysis false
+def register $dec-instructions Analysis false
+def register $dup-instructions Analysis false
+def register $halt-instructions Analysis false
+def register $output-instructions Analysis false
+def register $pop-instructions Analysis false
+def register $push-instructions Analysis false
+def register $return-instructions Analysis false
+def register $var-instructions Analysis false
+push 1046
+pop $$total-instructions
+push 12
+pop $$add-instructions
+push 24
+pop $$call-instructions
+push 36
+pop $$dec-instructions
+push 50
+pop $$dup-instructions
+push 62
+pop $$halt-instructions
+push 74
+pop $$output-instructions
+push 106
+pop $$pop-instructions
+push 120
+pop $$push-instructions
+push 132
+pop $$return-instructions
+push 144
+pop $$var-instructions
+halt \ No newline at end of file
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/stack.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/stack.pda
new file mode 100644
index 00000000000..c7fa1628b9c
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/stack.pda
@@ -0,0 +1,21 @@
+push 5
+:thread_create
+exec stack
+dec
+dup
+branch_not_zero thread_create
+push finished
+output
+halt
+:stack
+push 100
+:inner
+dup
+output
+dup
+branch_not_zero descend
+return
+:descend
+dec
+call inner
+return \ No newline at end of file
diff --git a/dsf/org.eclipse.cdt.examples.dsf.pda/samples/structures.pda b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/structures.pda
new file mode 100644
index 00000000000..b6f7cbf62ab
--- /dev/null
+++ b/dsf/org.eclipse.cdt.examples.dsf.pda/samples/structures.pda
@@ -0,0 +1,23 @@
+push one two three
+push 1 2 3
+push I II III
+var x
+var x.a
+var x.b
+var y
+var y.c
+var y.d
+var y.d.1
+var y.d.2
+var y.d.3
+pop $x
+pop $x.a
+pop $x.b
+pop $y
+pop $y.c
+pop $y.d
+pop $y.d.1
+pop $y.d.2
+pop $y.d.3
+push Done
+output \ No newline at end of file

Back to the top