Skip to content

Commit

Permalink
Update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
mole99 committed Apr 13, 2024
1 parent 1b7cbbe commit a034467
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 18 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Here is an animation using the time register:

## Architecture

Tiny Shader has four (mostly) general purpose registers, REG0 to REG4. REG0 is special in a way as it is the target or destination register for some instructions. All registers are 6 bit wide.
Tiny Shader has four (mostly) general purpose registers, REG0 to REG3. REG0 is special in a way as it is the target or destination register for some instructions. All registers are 6 bit wide.

### Input

Expand Down Expand Up @@ -66,10 +66,10 @@ The following instructions are supported by Tiny Shader. A program consists of 1
### Branches
|Instruction|Operation|Description|
|-----------|---------|-----------|
|IFEQ RA|TAKE <= RA == REG0|Execute the next instruction if RA equals REG0.|
|IFNE RA|TAKE <= RA != REG0|Execute the next instruction if RA does not equal REG0.|
|IFGE RA|TAKE <= RA >= REG0|Execute the next instruction if RA is greater then or equal REG0.|
|IFLT RA|TAKE <= RA < REG0|Execute the next instruction if RA is less than REG0.|
|IFEQ RA|TAKE <= RA == R0|Execute the next instruction if RA equals R0.|
|IFNE RA|TAKE <= RA != R0|Execute the next instruction if RA does not equal R0.|
|IFGE RA|TAKE <= RA >= R0|Execute the next instruction if RA is greater then or equal R0.|
|IFLT RA|TAKE <= RA < R0|Execute the next instruction if RA is less than R0.|
### Arithmetic
|Instruction|Operation|Description|
|-----------|---------|-----------|
Expand All @@ -84,7 +84,7 @@ The following instructions are supported by Tiny Shader. A program consists of 1
### Special
|Instruction|Operation|Description|
|-----------|---------|-----------|
|SINE RA|RA <= SINE[REG0[4:0]]|Get the sine value for REG0 and write into RA. The sine value LUT has 32 entries.|
|SINE RA|RA <= SINE[R0[4:0]]|Get the sine value for R0 and write into RA. The sine value LUT has 32 entries.|
### Boolean
|Instruction|Operation|Description|
|-----------|---------|-----------|
Expand Down
14 changes: 7 additions & 7 deletions docs/info.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,15 +52,15 @@ SETRGB R3

### Architecture

Tiny Shader has four (mostly) general purpose registers, REG0 to REG4. REG0 is special in a way as it is the target or destination register for some instructions. All registers are 6 bit wide.
Tiny Shader has four (mostly) general purpose registers, REG0 to REG3. REG0 is special in a way as it is the target or destination register for some instructions. All registers are 6 bit wide.

#### Input

The shader has four sources to get input from:

- `X` - X position of the current pixel
- `Y` - Y position of the current pixel
- `TIME` - Increases at 7.5 Hz, before it overflow it counts down again.
- `TIME` - Increments at 7.5 Hz, before it overflow it counts down again.
- `USER` - Register that can be set via the SPI interface.

#### Output
Expand Down Expand Up @@ -94,10 +94,10 @@ The following instructions are supported by Tiny Shader. A program consists of 1
#### Branches
|Instruction|Operation|Description|
|-----------|---------|-----------|
|IFEQ RA|TAKE <= RA == REG0|Execute the next instruction if RA equals REG0.|
|IFNE RA|TAKE <= RA != REG0|Execute the next instruction if RA does not equal REG0.|
|IFGE RA|TAKE <= RA >= REG0|Execute the next instruction if RA is greater then or equal REG0.|
|IFLT RA|TAKE <= RA < REG0|Execute the next instruction if RA is less than REG0.|
|IFEQ RA|TAKE <= RA == R0|Execute the next instruction if RA equals R0.|
|IFNE RA|TAKE <= RA != R0|Execute the next instruction if RA does not equal R0.|
|IFGE RA|TAKE <= RA >= R0|Execute the next instruction if RA is greater then or equal R0.|
|IFLT RA|TAKE <= RA < R0|Execute the next instruction if RA is less than R0.|
#### Arithmetic
|Instruction|Operation|Description|
|-----------|---------|-----------|
Expand All @@ -112,7 +112,7 @@ The following instructions are supported by Tiny Shader. A program consists of 1
#### Special
|Instruction|Operation|Description|
|-----------|---------|-----------|
|SINE RA|RA <= SINE[REG0[4:0]]|Get the sine value for REG0 and write into RA. The sine value LUT has 32 entries.|
|SINE RA|RA <= SINE[R0[4:0]]|Get the sine value for R0 and write into RA. The sine value LUT has 32 entries.|
#### Boolean
|Instruction|Operation|Description|
|-----------|---------|-----------|
Expand Down
10 changes: 5 additions & 5 deletions sw/assembler.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
'GETTIME' : {'format': 'single_operand', 'opcode': '00_0110', 'short': 'RA <= TIME', 'description': 'Set the specified register to the current time value, increases with each frame.', 'category': 'Input'},
'GETUSER' : {'format': 'single_operand', 'opcode': '00_0111', 'short': 'RA <= USER', 'description': 'Set the specified register to the user value, can be set via the SPI interface.', 'category': 'Input'},

'IFEQ' : {'format': 'single_operand', 'opcode': '00_1000', 'short': 'TAKE <= RA == REG0', 'description': 'Execute the next instruction if RA equals REG0.', 'category': 'Branches'},
'IFNE' : {'format': 'single_operand', 'opcode': '00_1001', 'short': 'TAKE <= RA != REG0', 'description': 'Execute the next instruction if RA does not equal REG0.', 'category': 'Branches'},
'IFGE' : {'format': 'single_operand', 'opcode': '00_1010', 'short': 'TAKE <= RA >= REG0', 'description': 'Execute the next instruction if RA is greater then or equal REG0.', 'category': 'Branches'},
'IFLT' : {'format': 'single_operand', 'opcode': '00_1011', 'short': 'TAKE <= RA < REG0', 'description': 'Execute the next instruction if RA is less than REG0.', 'category': 'Branches'},
'IFEQ' : {'format': 'single_operand', 'opcode': '00_1000', 'short': 'TAKE <= RA == R0', 'description': 'Execute the next instruction if RA equals R0.', 'category': 'Branches'},
'IFNE' : {'format': 'single_operand', 'opcode': '00_1001', 'short': 'TAKE <= RA != R0', 'description': 'Execute the next instruction if RA does not equal R0.', 'category': 'Branches'},
'IFGE' : {'format': 'single_operand', 'opcode': '00_1010', 'short': 'TAKE <= RA >= R0', 'description': 'Execute the next instruction if RA is greater then or equal R0.', 'category': 'Branches'},
'IFLT' : {'format': 'single_operand', 'opcode': '00_1011', 'short': 'TAKE <= RA < R0', 'description': 'Execute the next instruction if RA is less than R0.', 'category': 'Branches'},

'DOUBLE' : {'format': 'single_operand', 'opcode': '00_1100', 'short': 'RA <= RA * 2', 'description': 'Double the value of RA.', 'category': 'Arithmetic'},
'HALF' : {'format': 'single_operand', 'opcode': '00_1101', 'short': 'RA <= RA / 2', 'description': 'Half the value of RA.', 'category': 'Arithmetic'},
'CLEAR' : {'format': 'single_operand', 'opcode': '00_1110', 'short': 'RA <= 0', 'description': 'Clear RA by writing 0.', 'category': 'Load'},
'SINE' : {'format': 'single_operand', 'opcode': '00_1111', 'short': 'RA <= SINE[REG0[4:0]]', 'description': 'Get the sine value for REG0 and write into RA. The sine value LUT has 32 entries.', 'category': 'Special'},
'SINE' : {'format': 'single_operand', 'opcode': '00_1111', 'short': 'RA <= SINE[R0[4:0]]', 'description': 'Get the sine value for R0 and write into RA. The sine value LUT has 32 entries.', 'category': 'Special'},

# Boolean operations
'AND' : {'format': 'dual_operand', 'opcode': '01_00', 'short': 'RA <= RA & RB', 'description': 'Boolean AND of RA and RB, result written into RA.', 'category': 'Boolean'},
Expand Down

0 comments on commit a034467

Please sign in to comment.