From cf62bb4ee147c5ab51ada2437ac876f627fbb542 Mon Sep 17 00:00:00 2001 From: FreeArtMan Date: Sun, 14 Oct 2018 14:09:26 +0100 Subject: Initial cpu8 isa --- cpu8_spec/ISA_CPU8_0_0_4.md | 155 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 155 insertions(+) create mode 100644 cpu8_spec/ISA_CPU8_0_0_4.md diff --git a/cpu8_spec/ISA_CPU8_0_0_4.md b/cpu8_spec/ISA_CPU8_0_0_4.md new file mode 100644 index 0000000..47a71ee --- /dev/null +++ b/cpu8_spec/ISA_CPU8_0_0_4.md @@ -0,0 +1,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 + + \ No newline at end of file -- cgit v1.2.3