The reasons why you might want to get involved in this implementation of the B-Tree algorithm in Silicon rather than software are:
http://prb.appaapps.com/zesal/pitchdeck/pitchDeck.html
I implemented the B-Tree algorithm in Java, then successively reduced the Java code until it looked just like assembler code, at which point it was easy to generate a CPU in Verilog to execute the assembler code:
The Verilog CPU will now be implemented on an fpga and then as an application specific integrated circuit to implement the B-Tree algorithm in hardware rather than software.
-----------------------------------------------------------------------------------
| Tool Version : Vivado v.2024.2 (lin64) Build 5239630 Fri Nov 08 22:34:34 MST 2024
| Design : doc
| Design State : Synthesized
-----------------------------------------------------------------------------------
Example: finding the data associated with a database key
For a small tree:
BtreePA t = new BtreePA()
{int maxSize () {return 8;}
int maxKeysPerLeaf () {return 2;}
int maxKeysPerBranch() {return 3;}
int bitsPerKey () {return 4;}
int bitsPerData () {return 4;}
};
Vivado Synthesis uses the following resources to implement the find operation.
+-------------------------+------+-------+------------+-----------+-------+
| Site Type | Used | Fixed | Prohibited | Available | Util% |
+-------------------------+------+-------+------------+-----------+-------+
| Slice LUTs* | 581 | 0 | 0 | 41000 | 1.42 |
| LUT as Logic | 581 | 0 | 0 | 41000 | 1.42 |
| LUT as Memory | 0 | 0 | 0 | 13400 | 0.00 |
| Slice Registers | 131 | 0 | 0 | 82000 | 0.16 |
| Register as Flip Flop | 131 | 0 | 0 | 82000 | 0.16 |
| Register as Latch | 0 | 0 | 0 | 82000 | 0.00 |
| F7 Muxes | 10 | 0 | 0 | 20500 | 0.05 |
| F8 Muxes | 0 | 0 | 0 | 10250 | 0.00 |
+-------------------------+------+-------+------------+-----------+-------+
The tree being searched looks like this:
ok(t, """
4 |
0 |
5 |
6 |
2 6 7 |
5 6 6.1 |
1 4 7 |
3 2 |
1,2=1 3,4=3 5,6=4 7=7 8,9=2 |
""");
Running the generated Verilog code to find the data associated with database key 2 produces:
Stopped after: 117 steps key 2 data 7
The evolution of a B-Tree as the lowest element is deleted successively until the tree is empty.
At start with 32 elements
+----------------------------------------------------------------------------------------------------------------------------+
| 16 24 |
| 0 0.1 |
| 7 18 |
| 8 |
| 4 8 12 20 28 |
| 7 7.1 7.2 18 8 |
| 1 4 6 12 17 |
| 10 15 2 |
| 1,2,3,4=1 5,6,7,8=4 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+----------------------------------------------------------------------------------------------------------------------------+
After deleting: 1
+-----------------------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 4 8 12 20 24 28 |
| 7 7.1 7.2 18 18.1 18.2 |
| 1 4 6 12 15 17 |
| 10 2 |
| 2,3,4=1 5,6,7,8=4 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+-----------------------------------------------------------------------------------------------------------------------------+
After deleting: 2
+---------------------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 4 8 12 20 24 28 |
| 7 7.1 7.2 18 18.1 18.2 |
| 1 4 6 12 15 17 |
| 10 2 |
| 3,4=1 5,6,7,8=4 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+---------------------------------------------------------------------------------------------------------------------------+
After deleting: 3
+-------------------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 4 8 12 20 24 28 |
| 7 7.1 7.2 18 18.1 18.2 |
| 1 4 6 12 15 17 |
| 10 2 |
| 4=1 5,6,7,8=4 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+-------------------------------------------------------------------------------------------------------------------------+
After deleting: 4
+------------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 8 12 20 24 28 |
| 7 7.1 18 18.1 18.2 |
| 1 6 12 15 17 |
| 10 2 |
| 5,6,7,8=1 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+------------------------------------------------------------------------------------------------------------------+
After deleting: 5
+----------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 8 12 20 24 28 |
| 7 7.1 18 18.1 18.2 |
| 1 6 12 15 17 |
| 10 2 |
| 6,7,8=1 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+----------------------------------------------------------------------------------------------------------------+
After deleting: 6
+--------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 8 12 20 24 28 |
| 7 7.1 18 18.1 18.2 |
| 1 6 12 15 17 |
| 10 2 |
| 7,8=1 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+--------------------------------------------------------------------------------------------------------------+
After deleting: 7
+------------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 8 12 20 24 28 |
| 7 7.1 18 18.1 18.2 |
| 1 6 12 15 17 |
| 10 2 |
| 8=1 9,10,11,12=6 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+------------------------------------------------------------------------------------------------------------+
After deleting: 8
+------------------------------------------------------------------------------------------------------+
| 16 |
| 0 |
| 7 |
| 18 |
| 12 20 24 28 |
| 7 18 18.1 18.2 |
| 1 12 15 17 |
| 10 2 |
| 9,10,11,12=1 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+------------------------------------------------------------------------------------------------------+
After deleting: 9
+---------------------------------------------------------------------------------------------------+
| 20 |
| 0 |
| 7 |
| 18 |
| 12 16 24 28 |
| 7 7.1 18 18.1 |
| 1 10 15 17 |
| 12 2 |
| 10,11,12=1 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+---------------------------------------------------------------------------------------------------+
After deleting: 10
+------------------------------------------------------------------------------------------------+
| 20 |
| 0 |
| 7 |
| 18 |
| 12 16 24 28 |
| 7 7.1 18 18.1 |
| 1 10 15 17 |
| 12 2 |
| 11,12=1 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+------------------------------------------------------------------------------------------------+
After deleting: 11
+---------------------------------------------------------------------------------------------+
| 20 |
| 0 |
| 7 |
| 18 |
| 12 16 24 28 |
| 7 7.1 18 18.1 |
| 1 10 15 17 |
| 12 2 |
| 12=1 13,14,15,16=10 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+---------------------------------------------------------------------------------------------+
After deleting: 12
+------------------------------------------------------------------------------------+
| 20 |
| 0 |
| 7 |
| 18 |
| 16 24 28 |
| 7 18 18.1 |
| 1 15 17 |
| 12 2 |
| 13,14,15,16=1 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+------------------------------------------------------------------------------------+
After deleting: 13
+--------------------------------------------------------------------------------+
| 24 |
| 0 |
| 7 |
| 18 |
| 16 20 28 |
| 7 7.1 18 |
| 1 12 17 |
| 15 2 |
| 14,15,16=1 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+--------------------------------------------------------------------------------+
After deleting: 14
+-----------------------------------------------------------------------------+
| 24 |
| 0 |
| 7 |
| 18 |
| 16 20 28 |
| 7 7.1 18 |
| 1 12 17 |
| 15 2 |
| 15,16=1 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+-----------------------------------------------------------------------------+
After deleting: 15
+--------------------------------------------------------------------------+
| 24 |
| 0 |
| 7 |
| 18 |
| 16 20 28 |
| 7 7.1 18 |
| 1 12 17 |
| 15 2 |
| 16=1 17,18,19,20=12 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+--------------------------------------------------------------------------+
After deleting: 16
+-----------------------------------------------------------------+
| 24 |
| 0 |
| 7 |
| 18 |
| 20 28 |
| 7 18 |
| 1 17 |
| 15 2 |
| 17,18,19,20=1 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+-----------------------------------------------------------------+
After deleting: 17
+----------------------------------------------------------------+
| 20 24 28 |
| 0 0.1 0.2 |
| 1 15 17 |
| 2 |
| 18,19,20=1 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+----------------------------------------------------------------+
After deleting: 18
+-------------------------------------------------------------+
| 20 24 28 |
| 0 0.1 0.2 |
| 1 15 17 |
| 2 |
| 19,20=1 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+-------------------------------------------------------------+
After deleting: 19
+----------------------------------------------------------+
| 20 24 28 |
| 0 0.1 0.2 |
| 1 15 17 |
| 2 |
| 20=1 21,22,23,24=15 25,26,27,28=17 29,30,31,32=2 |
+----------------------------------------------------------+
After deleting: 20
+-------------------------------------------------+
| 24 28 |
| 0 0.1 |
| 1 17 |
| 2 |
| 21,22,23,24=1 25,26,27,28=17 29,30,31,32=2 |
+-------------------------------------------------+
After deleting: 21
+----------------------------------------------+
| 24 28 |
| 0 0.1 |
| 1 17 |
| 2 |
| 22,23,24=1 25,26,27,28=17 29,30,31,32=2 |
+----------------------------------------------+
After deleting: 22
+-------------------------------------------+
| 24 28 |
| 0 0.1 |
| 1 17 |
| 2 |
| 23,24=1 25,26,27,28=17 29,30,31,32=2 |
+-------------------------------------------+
After deleting: 23
+----------------------------------------+
| 24 28 |
| 0 0.1 |
| 1 17 |
| 2 |
| 24=1 25,26,27,28=17 29,30,31,32=2 |
+----------------------------------------+
After deleting: 24
+-------------------------------+
| 28 |
| 0 |
| 1 |
| 2 |
| 25,26,27,28=1 29,30,31,32=2 |
+-------------------------------+
After deleting: 25
+----------------------------+
| 28 |
| 0 |
| 1 |
| 2 |
| 26,27,28=1 29,30,31,32=2 |
+----------------------------+
After deleting: 26
+-------------------------+
| 28 |
| 0 |
| 1 |
| 2 |
| 27,28=1 29,30,31,32=2 |
+-------------------------+
After deleting: 27
+----------------------+
| 28 |
| 0 |
| 1 |
| 2 |
| 28=1 29,30,31,32=2 |
+----------------------+
After deleting: 28
+--------------+
| 29,30,31,32=0 |
+--------------+
After deleting: 29
+-----------+
| 30,31,32=0 |
+-----------+
After deleting: 30
+--------+
| 31,32=0 |
+--------+
After deleting: 31
+-----+
| 32=0 |
+-----+
After deleting: 32
+---+
| =0 |
+---+