<commit_before># furry-parakeet
A ~~simple-ish~~ small-ish, overly complicated, and poorly thought-out ISA and
maybe an implementation.

## Registers

Register | Size | Operand ID
:-   | :-: | :-:
acca | 24b | 001
accb | 24b | 010
accc | 48b | 011
baka | 24b | 101
bakb | 24b | 110
bakc | 48b | 111
ip   | 24b |  -
sp   | 24b |  -
bp   | 24b |  -
flag | 24b |  -

## Instruction Format

### r-class

 - 12b
 - `0` = `0`
 - `c` = opcode
 - `o` = destination operand
 - `p` = second operand

        c0c ccc ooo ppp

### i-class

 - 24b
 - `0` = `0`
 - `1` = `1`
 - `c` = opcode
 - `o` = destination operand
 - `i` = immediate value

        01c ccc ooo iii iii iii iii iii

## Opcode Listing

 Hob\Lob |  000 | 001  | 010  | 011  | 100 | 101  | 110 | 111
   :-:   |  :-: | :-:  | :-:  | :-:  | :-: | :-:  | :-: | :-:
   000   | noop | swp  | push | pop  | add | sub  | mul | div
   001   | jmp  | jz   | jnz  | jlz  | not | and  | or  | xor
   010   | merg | splt |  -   |  -   | add | sub  | mul | div
   011   | jmp  | jz   | jnz  | jlz  | imm | immh |  -  |  -
   100   | int  |  -   | sto  | load |  -  |  -   |  -  |  -
   101   |  -   |  -   |  -   |  -   |  -  |  -   |  -  |  -
   110   |  -   |  -   |  -   |  -   |  -  |  -   |  -  |  -
   111   |  -   |  -   |  -   |  -   |  -  |  -   |  -  |  -

### `add`

 - Format: r-class
 - Opcode: 000 100
 - Operands:
      - `ooo`: Destination register to add to.
      - `ppp`: Second regist to add.
 - Description: Adds value in register `ppp` to register `ooo`.

---

 - Format: i-class
 - Opcode: 010 100
 - Operands:
      - `ooo`: Destination register to add to.
      - `i`: Value to add.
 - Description: Adds immediate value to register `ooo`.

### `and`

 - Format: r-class
 - Opcode: 001 101
 - Operands:
      - `ooo`: First input and destination.
      - `ppp`: Second input.
 - Description: Performs a logical and of `ooo` and `ppp`, storing the result
   into `ooo`.

### `div`

 - Format: r-class
 - Opcode: 000 111
 - Operands:
      - `ooo`: Dividend and destionation.
      - `ppp`: Divisor.
 - Description: Performs integer division of `ooo` by `ppp`, storing the
   quotient in `ooo` and the remainder in `ooo`'s alternative.

---

 - Format: i-class
 - Opcode: 010 111
 - Operands:
      - `ooo`: Dividend and destination.
      - `i`: Divisor.
 - Description: Performs integer division of `ooo` by `i`, storing the quotient
   in `ooo` and the remainder in `ooo`'s alternative.

### `imm`

 - Format: i-class
 - Opcode: 011 100
 - Operands:
      - `ooo`: Destination register.
      - `i`: Value.
 - Description: Stores `i` in `ooo`, using sign extension to fill the upper
   bits.

`immh`

`int`

`jlz`

`jmp`

`jnz`

`jz`

`load`

### `merg`

 - Format: i-class
 - Opcode: 010 000
 - Operands:
      - `ooo`: Ignored<commit_msg>Define immh<commit_after># furry-parakeet
A ~~simple-ish~~ small-ish, overly complicated, and poorly thought-out ISA and
maybe an implementation.

## Registers

Register | Size | Operand ID
:-   | :-: | :-:
acca | 24b | 001
accb | 24b | 010
accc | 48b | 011
baka | 24b | 101
bakb | 24b | 110
bakc | 48b | 111
ip   | 24b |  -
sp   | 24b |  -
bp   | 24b |  -
flag | 24b |  -

## Instruction Format

### r-class

 - 12b
 - `0` = `0`
 - `c` = opcode
 - `o` = destination operand
 - `p` = second operand

        c0c ccc ooo ppp

### i-class

 - 24b
 - `0` = `0`
 - `1` = `1`
 - `c` = opcode
 - `o` = destination operand
 - `i` = immediate value

        01c ccc ooo iii iii iii iii iii

## Opcode Listing

 Hob\Lob |  000 | 001  | 010  | 011  | 100 | 101  | 110 | 111
   :-:   |  :-: | :-:  | :-:  | :-:  | :-: | :-:  | :-: | :-:
   000   | noop | swp  | push | pop  | add | sub  | mul | div
   001   | jmp  | jz   | jnz  | jlz  | not | and  | or  | xor
   010   | merg | splt |  -   |  -   | add | sub  | mul | div
   011   | jmp  | jz   | jnz  | jlz  | imm | immh |  -  |  -
   100   | int  |  -   | sto  | load |  -  |  -   |  -  |  -
   101   |  -   |  -   |  -   |  -   |  -  |  -   |  -  |  -
   110   |  -   |  -   |  -   |  -   |  -  |  -   |  -  |  -
   111   |  -   |  -   |  -   |  -   |  -  |  -   |  -  |  -

### `add`

 - Format: r-class
 - Opcode: 000 100
 - Operands:
      - `ooo`: Destination register to add to.
      - `ppp`: Second regist to add.
 - Description: Adds value in register `ppp` to register `ooo`.

---

 - Format: i-class
 - Opcode: 010 100
 - Operands:
      - `ooo`: Destination register to add to.
      - `i`: Value to add.
 - Description: Adds immediate value to register `ooo`.

### `and`

 - Format: r-class
 - Opcode: 001 101
 - Operands:
      - `ooo`: First input and destination.
      - `ppp`: Second input.
 - Description: Performs a logical and of `ooo` and `ppp`, storing the result
   into `ooo`.

### `div`

 - Format: r-class
 - Opcode: 000 111
 - Operands:
      - `ooo`: Dividend and destionation.
      - `ppp`: Divisor.
 - Description: Performs integer division of `ooo` by `ppp`, storing the
   quotient in `ooo` and the remainder in `ooo`'s alternative.

---

 - Format: i-class
 - Opcode: 010 111
 - Operands:
      - `ooo`: Dividend and destination.
      - `i`: Divisor.
 - Description: Performs integer division of `ooo` by `i`, storing the quotient
   in `ooo` and the remainder in `ooo`'s alternative.

### `imm`

 - Format: i-class
 - Opcode: 011 100
 - Operands:
      - `ooo`: Destination register.
      - `i`: Value.
 - Description: Stores `i` in `ooo`, using sign extension to fill the upper
   bits.

### `immh`

 - Format: i-class
 - Opcode: 011 101
 - Operands:
      - `ooo`: Destination register.
      - `i`: Value.
 - Description: Stores the lower 12 bits of `i` in the upper 12 bits of `ooo`.
   The lower 12 bits of `ooo` are unmodified.

`int`

`jlz`

`jmp`

`jnz`

`jz`

`load`

### `merg`

 - Format: i-class
 - Opcode: 010 000
 - Operands:
      - `ooo`: Ignored
{'fraction_non_alphanumeric': 0.16381668946648426, 'fraction_numerical': 0.05027359781121751, 'mean_word_length': 1.7563619227144203, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '994787', 'n_tokens_mistral': 2689, 'n_tokens_neox': 2303, 'n_words': 672}