diff -r db5ece2206cf -r 6d54ccb29de4 draft/a-bit-of-risc.org --- a/draft/a-bit-of-risc.org Mon Aug 12 18:31:37 2024 -0400 +++ b/draft/a-bit-of-risc.org Sun Aug 18 22:16:12 2024 -0400 @@ -1,6 +1,7 @@ #+title: A Bit of RISC #+date: [2024-03-11 Mon] #+setupfile: ../../clean.theme +#+property: header-args :eval no-export I recently picked up [[https://dl.acm.org/doi/10.5555/2462741][Hacker's Delight]] and having a lot of fun with it. It's a collection of bit-manipulation tricks collected by hackers over many years. You can flip open pretty much anywhere in the book @@ -21,7 +22,13 @@ You can find most of the code from the book [[https://github.com/hcs0/Hackers-Delight][here]]. * Design +:PROPERTIES: +:ID: c030566f-1ede-4edc-b393-d2c6c1c2d19f +:END: ** Data Representation +:PROPERTIES: +:ID: 6d93e084-1047-4a33-adb3-5c90af96ead0 +:END: We'll be sticking with a 32-bit word length as recommended in the Preface. We will also represent registers as integers whenever possible, instead of say a bit-vector. Without going into too much @@ -36,6 +43,9 @@ Floating-point support and special purpose registers are not required. ** Instructions +:PROPERTIES: +:ID: fb86a212-b49a-44ff-b30b-32c789ca55e2 +:END: The Hacker's Delight RISC architecture is described in two tables, denoted =basic RISC= and =full RISC= respectively. @@ -103,6 +113,9 @@ instructions directly to Lisp functions using macros. ** Execution Model +:PROPERTIES: +:ID: f84fcd3d-86ad-4b9b-a330-4572d6120559 +:END: We'll build this machine in Lisp and use plenty intrinsics from SBCL. As a starting point I followed Paul Khuong's excellent blog post: [[https://pvk.ca/Blog/2014/03/15/sbcl-the-ultimate-assembly-code-breadboard/][SBCL: The ultimate assembly code breadboard]]. @@ -116,6 +129,7 @@ * The HAKMEM VM :properties: :header-args: :session t :results none :noeval t +:ID: 43484c58-ab29-481c-b2b9-17ab4d91e22f :end: #+name: defpackage #+begin_src lisp