testbench: Add concept source file

Signed-off-by: Ian Moffett <ian@mirocom.org>
This commit is contained in:
2026-05-23 02:13:16 -04:00
parent 0fe401d0a7
commit 9dddb49288
+22
View File
@@ -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