summaryrefslogtreecommitdiff
path: root/cpu8_spec/ISA_CPU8_0_0_4.md
blob: 47a71eeb431f2017ae918c6cfdab7680ec126b6a (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
# ISA

## Intro
create 8 bit risc cpu named CPU8, alldata is sended trought serail interface and read
with io commands

## Goals

create cpu description for 8 bit mini cpu

# Architecrure overveiw
## RAM
RAM size 64k(minimal addressable amount 2/4bytes? TBD), should be enought for most operations
register amount TBD, as much as possible?

## CPU
CPU supports simple command executions, data for registers are transsfered
from internal RAM.
Supports simple IRQ of operatio  results

# Command set

Command size 16bit(maybe change to 32bits?)
will be enought to handle alot of registers, and vectors, anc crc and stuff), data size is 8bit
Commands are in format

CMD REG, MEM
CMD REG, PARAM
CMD REG, REG
CMD MEM, REG

# Command types
## Arithmetical
### Addition
__ADD reg, reg__
__INC reg__
### Substraction
__SUB reg, reg__
__DEC__
### Multiplication
__MUL reg, reg__
### Division
__DIV reg, reg__

### Modulo
__MOD reg, reg__

### Reverse
__NEG reg__

### Bitwise OR
__OR REG, REG__

### Bitwise AND
__AND REG, REG__

### Bitwise XOR
__XOR REG, REG__

### Compare
Equal
__CMPE REG, REG__
above
__CMPA REG, REG__
belove
__CMPB REG, REG__
equal or above
__CMPEA REG, REG__
equal or belove
__CMPEB REG, REG__
Not equal
__CMPNE REG, REG__
### Jump
program treated like RO written to memory, not possible to modify from programm itself
__JMP STEP__


### Set values to register
__SET REG, VAL__
__SET REG, MEM__


## Memory manipulations
### SETZEROS
__SETZ reg__
SETZ mem

### SET TO VALUE
__SETV reg, [8bit]__
SETV mem, [8bit]

## IO manipulation
### Get value from port
__INB reg, port__
### Set value to prot
__OUTB port, reg__
### Input port state
__INSTATE reg, port__
### Output port state
__OUTSTATE port, reg__
### Port type
__PORTT port__
check what kind of device is at that port

## State manipulation
### Read IO statu register
__SIO reg__

## Interrupt managment
### Rise intrrupt
__INT num__
    rise interrupt
### Interrupt handling
#### Disable interrupt
__INTD num__
#### Enable interrupt
__INTE num__


# Interfaces to outer worlds

Serial interface, from CPU point of view, writting writes byte to port,
further thats is translated to port

Supported interfaces could be I2C, SPI, I2S, 1wite, trought FPGA
that could connect some real world stuff, like terminal or any
otherkind of device. 

# Interrupt handler
Interrupt handlder recieve interrupt, get address from interrupt table and jump
according to address in interrupt table.


## Interrupt type
### Arithmetic error
### Memory error
### Hardware error
### User defined interrupts
User can define or map any kind of event to interrupt, and when its happends then
interrupt workout where to jump in a codespace.

# Implementation plan
Steps to do finish projects

Create
  Initial block diagramm
  Assembler
  Disassembler
  Block diagramm
  Some programs for real world
  Implementation in FPGA?
    More step to describe
  Real world example usage, calc temperature from sensor