summaryrefslogtreecommitdiff
path: root/testbench/concept.cescal
diff options
context:
space:
mode:
authorIan Moffett <ian@mirocom.org>2026-05-23 02:13:16 -0400
committerIan Moffett <ian@mirocom.org>2026-05-23 02:13:16 -0400
commit9dddb49288988d06c3075cf3fc3dfd0fd20cd1aa (patch)
tree6767d6ec7ea8579a9f9793d8e914c41ba00ce941 /testbench/concept.cescal
parent0fe401d0a73d545999afccdca08105b3623fb1fe (diff)
testbench: Add concept source file
Signed-off-by: Ian Moffett <ian@mirocom.org>
Diffstat (limited to 'testbench/concept.cescal')
-rw-r--r--testbench/concept.cescal22
1 files changed, 22 insertions, 0 deletions
diff --git a/testbench/concept.cescal b/testbench/concept.cescal
new file mode 100644
index 0000000..6787362
--- /dev/null
+++ b/testbench/concept.cescal
@@ -0,0 +1,22 @@
+//
+// Copyright (c) 2026, Chloe M.
+// Provided under the BSD-3 clause
+//
+
+//
+// Operations can only be performed on registers but not
+// variables. Register names follow this convention:
+// -----------------------------------------------------
+// r<bitwidth>:name
+//
+pub proc log2(v : u64) -> u64 begin
+ r64:cnt = 0;
+ r64:tmp = v;
+
+ while (r64:tmp != 0) begin
+ r64:tmp >>= 1;
+ r64:cnt += 1;
+ end
+
+ return r64:cnt;
+end