Coder Social home page Coder Social logo

kk4ead / stack16 Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 212 KB

A simple 16-bit stack machine, designed to be implemented with only 7400-series devices.

License: GNU General Public License v3.0

Verilog 61.27% Makefile 5.20% C 0.22% C++ 33.31%

stack16's Introduction

stack16

A simple 16-bit stack machine, designed to be implemented with only 7400-series devices.

There are two 16-bit data registers named TOP and NEXT, and an 8-bit instruction register, implemented as flip-flops with clock enable inputs.

A 16-bit program counter and 15-bit data and return stack pointers are implemented as up/down counters with clock enables. Their values are not directly accessible. On a processor reset (or, for the program counter, on an interrupt), they are loaded from DIP switches.

Memory access is word-aligned. This is not especially efficient, unless I come up with a clever instruction set encoding that makes procedure calls and integer literals take only one word.

During every microinstruction cycle:

  • The address bus is driven by either the TOP register, the program counter, the data stack pointer, or the return stack pointer.
  • The data bus is driven by either the program counter, the result of an ALU operation on the TOP and the NEXT registers, or memory.
  • Memory may be written to if it is not being read from.
  • The TOP register, the NEXT register, the program counter, or the instruction register may be loaded from the data bus.
  • One counter may be incremented or decremented.
  • The next microstate is loaded into a 4-bit register from microprogram memory.

A 64K word x 24 bit EEPROM stores the microprogram.

  • 4 of the address bits are driven by the present microstate (limiting the length of any instruction to a maximum of 16 cycles).
  • 8 are driven by the instruction register.
  • 3 are driven by the "flag" outputs of the ALU (sign, zero, and carry).
  • 1 is driven by the IRQ pin. This is not especially efficient, but it minimizes chip count.

The simulation requires Mark C. Hansen's Verilog behavioral model of the 74181 4-bit ALU, available here for research use. If you have curl installed, 'make deps' will automatically download it.

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.