summaryrefslogtreecommitdiff
path: root/tb/sim/fibonacci.c
diff options
context:
space:
mode:
authorAlejandro Soto <alejandro@34project.org>2022-10-16 16:02:52 -0600
committerAlejandro Soto <alejandro@34project.org>2022-10-16 16:02:52 -0600
commita5468f968b46707e08eacf79847f1e12a4213ff7 (patch)
treeb67da1116bf1a87b9cd113f0f9c25c3a9b9672e9 /tb/sim/fibonacci.c
parent851e6ff85a8d2dabdfc0234abd0b284aed8e5031 (diff)
Add C simulation testbench
Diffstat (limited to 'tb/sim/fibonacci.c')
-rw-r--r--tb/sim/fibonacci.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/tb/sim/fibonacci.c b/tb/sim/fibonacci.c
new file mode 100644
index 0000000..f02398a
--- /dev/null
+++ b/tb/sim/fibonacci.c
@@ -0,0 +1,13 @@
+void reset()
+{
+ int a = 1, b = 1, *p = (int*)0x00010000;
+
+ for(int i = 0; i < 20; ++i)
+ {
+ int c = a + b;
+
+ *p++ = a;
+ a = b;
+ b = c;
+ }
+}