Git Product home page Git Product logo

x18-32's Introduction

X18-32 CPU  By Arlet Ottens <[email protected]>


The X18 CPU is a small CPU core for FPGA control tasks. It is meant to run
from Xilinx FPGA block RAM, exploiting the 2 extra parity bits for free
extra opcode space.

It has 16 registers, and a small internal stack (not accessible for
programs). It uses a Harvard architecture, but the code space is also
accessible in the data space through the use a dual port block RAM.

Most instructions run single cycle, except memory loads/moves, which take
two cycles.  The barrel shifter operations also take two cycles, to allow
extra pipelining and higher clock rate. The same applies to the optional
multiply instruction.

The project goals were:

- high code density 
- minimal resources/simplicity 
- high speed 
- rich memory operations (auto inc/dec and copy)

Because the CPU is meant to be used for different control tasks inside an
FPGA, it is hard to specify exactly what it needs to have. The simplicity
of the design allows fairly easily tailoring to a specific task where you
can remove instructions you don't need, and replace them with other ones.

Instruction format:


ALU Immediate:
   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 0 | 0 |   operation   |      dst      |              imm              | 
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Move:

   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 0 | 1 | smode | dmode |      dst      |      src      |     offset    | 
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

ALU:
   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 1 | 0 |   operation   |      dst      |      src      |    reserved   | 
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Return:
   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 1 | 1 | 0 | 0 |                     must be zero                      | 
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Call:
   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 1 | 1 | 0 | 1 |                        address                        | 
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

JMP:
   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 1 | 1 | 1 | 0 |                        address                        |
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

Branch:
   17  16  15  14  13  12  11  10   9   8   7   6   5   4   3   2   1   0
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+
  | 1 | 1 | 1 | 1 |    cond   |                     rel                   | 
  +---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+---+

 'operation' can be one of the following:

  two cycle operations (00--)
 
  0000 logical shift right
  0001 logical shift left
  0010 (multiply)
  0011 -- reserved

  single cycle operations

  0100 bitwise and
  0101 bitwise or
  0110 bitwise xor
  0111 -- reserved
  1000 bitwise invert
  1001 memory load
  1010 move 
  1011 byte swap
  1100 add
  1101 -- reserved
  1110 subtract
  1111 compare

  smode/dmode can be one of the following:

  00 direct register load/store ("mov reg, reg" not supported)
  01 indirect load/store (offset is added to base address)
  02 indirect load/store with pre-decrement
  03 indirect load/store with post-increment
  
  branch cond codes:

  000 BEQ 
  001 BNE 
  010 BCS
  011 BCC
  100 BMI
  101 BPL
  110 BLT (signed less than)
  111 BGE (signed greater or equal)

x18-32's People

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.