OpenCores
URL https://opencores.org/ocsvn/zipcpu/zipcpu/trunk

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [README.md] - Blame information for rev 209

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 208 dgisselq
# The Zip CPU
2
 
3
The Zip CPU is a small, light-weight, RISC CPU.  Specific design goals include:
4
- 32-bit.  All registers, addresses, and instructions are 32-bits in length.  While the byte-size itself was at one time 32-bits, the CPU now handles 8-bit bytes like all other CPUs
5 209 dgisselq
- A RISC CPU.  Instructions nominally complete in one cycle each, with exceptions for multiplies, divides, memory accesses, and (eventually) floating point instructions.
6 208 dgisselq
- A load/store architecture.  Only load and store instructions may access memory.
7
- Wishbone compliant.  All memory and peripherals are accessed across a single wishbone bus.
8
- A Von-Neumann architecture, meaning that both instructions and data share a common bus.
9
- A pipelined architecture, having stages for prefetch, decode, read-operand(s), a combined stage containing the ALU, memory, divide, and floating point units, and then the final write-back stage.
10
- A two mode machine: supervisor and user, with each mode having a different access level.
11
- Completely open source, licensed under the GPL.
12
 
13
## Unique features and characteristics
14
 
15
- Only 29 instructions are currently implemented.  Six additional instructions have been reserved for a floating point unit, but such a unit has yet to be implemented.
16 209 dgisselq
- (Almost) all instructions can be executed conditionally.  Exceptions include load immediate, the debug break instruction, the bus lock and simulation instructions, and the no-operation instruction.  The assembler will quietly turn a conditional load immediate into a two-instruction equivalent.
17
- Simplfied wishbone bus.  While the ZipCPU conforms to the Wishbone B4 standard, some simplifications have been made.  All tgx lines have been removed, although the select lines have been kept.  All accesses are (or can be) pipelined.  Finally, the ZipCPU project (and its daughter projects/[peripherals](rtl/peripherals)) assumes that the strobe line is zero whenever the cycle is zero.  This simplifies peripheral processing.
18 208 dgisselq
- The CPU makes heavy use of pipelined wishbone processing wherever and whenever it can.  Hence, loading two vaues in a row may cost only one clock more than just loading the one value.
19
- The CPU has no interrupt vectors, but rather two register sets.  On any interrupt, the CPU just switches from the user register set to the supervisor register set.  This simplifies interrupt handling, since the CPU automatically saves, preserves, and restores the supervisor's context between enabling interrupts and receiving the next interrupt.  An [interrupt peripheral](rtl/peripherals/icontrol.v) handles the combining of multiple interrupts into a single interrupt line.
20
 
21 209 dgisselq
## Getting Started
22
 
23
If you'd like to get started with the ZipCPU, you might wish to know that this
24
repository contains the [CPU](./rtl/core/zipcpu.v), its [documentation](./doc/spec.pdf), and the [toolchain](./sw).
25
The CPU implementation found here, though, is just that: a CPU.  This
26
implementation requires a bus with peripherals hanging off of it, things such
27
as [RAM](https://github.com/ZipCPU/zbasic/blob/master/rtl/memdev.v),
28
[flash (ROM)](https://github.com/ZipCPU/zbasic/blob/master/rtl/wbqspiflash.v),
29
[serial port](https://github.com/ZipCPU/wbuart32), etc.  This is just where
30
I keep the CPU apart from any necessary peripherals.
31
 
32
So, if you want to try out the CPU, feel free to download and build this
33
repository (use `git-clone` with a depth of 1--there's a lot of stuff in the
34
git repo that you don't necessarily need).  You'll need it for the binutils,
35
GCC, and [newlib](https://sourceware.org/newlib) support provided by it.
36
 
37
Once you've built these tools, then I'd suggest you look into the
38
[ZBasic repository](https://github.com/ZipCPU/zbasic).  That repository places
39
the CPU in an environment with
40
[block RAM](https://github.com/ZipCPU/zbasic/blob/master/rtl/memdev.v),
41
[QSPI flash](https://github.com/ZipCPU/zbasic/blob/master/rtl/wbqspiflash.v),
42
and [SD-card (SPI protocol)](https://github.com/ZipCPU/sdspi) access.  From
43
that repository, you can either tweak the distro
44
([main.v](https://github.com/ZipCPU/zbasic/blob/master/rtl/main.v),
45
[regdefs.h](https://github.com/ZipCPU/zbasic/blob/master/sw/host/regdefs.h),
46
[board.h](https://github.com/ZipCPU/zbasic/blob/master/sw/zlib/board.h),
47
[board.ld](https://github.com/ZipCPU/zbasic/blob/master/sw/board/board.ld)) to
48
add the peripherals you want to use the CPU with, or you can use
49
[autofpga](https://github.com/ZipCPU/autofpga)
50
to adjust your RAM size, add or remove peripherals and so forth while
51
maintaining (creating, really) all of these files for you.
52
 
53
Even more than that,
54
the [ZBasic distribution](https://github.com/ZipCPU/zbasic) has complete
55
[Verilator support](https://github.com/ZipCPU/zbasic/tree/sim/verilator)
56
so that you can build your design, and simulate it, from
57
power on reset through bootloader through ... well, however far you'd like to
58
simulate and your disk has space for.
59
 
60
If you aren't interested in simulating the CPU, there is an assembly level
61
[debugger](https://github.com/ZipCPU/zbasic/blob/master/sw/host/zipdbg.cpp)
62
that you can use to stop and step the CPU, as well as an
63
integrated [wishbone scope](https://github.com/ZipCPU/wbscope) that
64
you can use to get traces from within the design while it is running.
65
 
66
 
67
## Need help?
68
 
69
If you'd like to use the ZipCPU, and don't know where to begin, feel free
70
to find me on IRC as ZipCPU.  I tend to inhabit the #openarty channel
71
of the Freenode IRC server.  If you get stuck, I've been known to help folks
72
out there as well.
73
 
74 208 dgisselq
## Current Status
75
 
76 209 dgisselq
I've recently blogged about the ZipCPU at [zipcpu.com](http://zipcpu.com)!
77
Articles you might find valuable include:
78 208 dgisselq
 
79 209 dgisselq
- [An overview of the ZipCPU's ISA](http://zipcpu.com/zipcpu/2018/01/01/zipcpu-isa.html)
80
- [How-to build the tool-chain, and test the CPU](http://zipcpu.com/zipcpu/2018/01/31/cpu-build.html)
81
- [Formal properties of a WB bus](http://zipcpu.com/zipcpu/2017/11/07/wb-formal.html)
82
- [Formally proving the prefetch](http://zipcpu.com/zipcpu/2017/11/18/prefetch.html)
83 208 dgisselq
 
84 209 dgisselq
I'm also working on [formally verifying the entire
85
CPU](http://zipcpu.com/blog/2018/01/22/formal-progress.html).  My goal will be
86
to [prove, via
87
yosys-smtbmc](http://zipcpu.com/blog/2017/10/19/formal-intro.html), that the
88
ZipCPU will never enter into an invalid state.  I've been successful so far
89
proving the various components of the ZipCPU.  What remains is the CPU
90
itself.
91
 
92
 
93 208 dgisselq
## Not yet integrated
94
 
95 209 dgisselq
- An [MMU](rtl/peripherals/zipmmu.v) has been written for the ZipCPU, and even
96
  integrated into it, but it has not yet been tested.  Using
97
  [formal methods](http://zipcpu.com/blog/2017/10/19/formal-intro.html),
98
  I've now proved that this component works.  A
99
  [test bench](sim/verilator/zipmmu_tb.cpp) also exists
100
  to exercise it.
101 208 dgisselq
 
102 209 dgisselq
- A [data cache](../../tree/master/rtl/core/dcache.v) has been
103
  written for the ZipCPU, but has yet to be fully optimized.
104
 
105
- I would also like to integrate [SDCard
106
  support](https://github.com/ZipCPU/sdspi) into the
107
  [newlib](https://sourceware.org/newlib) C-library to give
108
  the CPU file access.  If and when this takes place, it will take place as
109
  part of the [ZBasic repository](https://github.com/ZipCPU/zbasic) first.
110
 
111
- The [ZipOS](https://github.com/ZipCPU/s6soc/tree/master/sw/zipos)
112
  would greatly speed up and improve the bare bones [newlib](https://sourceware.org/newlib) library--primarily
113
  by providing "O/S" level interrupt support when using the library.  This
114
  integration has not (yet) been accomplished.
115
 
116
  On the other hand, if the [MMU](rtl/peripherals/zipmmu.v) is available,
117
  I might rather just create a Linux distribution.
118
 
119 208 dgisselq
## Commercial Opportunities
120
 
121 209 dgisselq
If the [GPLv3 license](https://www.gnu.org/licenses/gpl-3.0.en.html) is
122
insufficient for your needs, other licenses (for all but the tool-chain) can
123
be purchased from Gisselquist Technology, LLC.
124 208 dgisselq
 

powered by: WebSVN 2.1.0

© copyright 1999-2021 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.