1 |
54 |
dgisselq |
////////////////////////////////////////////////////////////////////////////////
|
2 |
|
|
//
|
3 |
|
|
// Filename: zipsys.h
|
4 |
|
|
//
|
5 |
|
|
// Project: OpenArty, an entirely open SoC based upon the Arty platform
|
6 |
|
|
//
|
7 |
|
|
// Purpose: Declare the capabilities and memory structure of the ZipSystem
|
8 |
|
|
// for programs that must interact with it.
|
9 |
|
|
//
|
10 |
|
|
// Creator: Dan Gisselquist, Ph.D.
|
11 |
|
|
// Gisselquist Technology, LLC
|
12 |
|
|
//
|
13 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
14 |
|
|
//
|
15 |
|
|
// Copyright (C) 2015-2016, Gisselquist Technology, LLC
|
16 |
|
|
//
|
17 |
|
|
// This program is free software (firmware): you can redistribute it and/or
|
18 |
|
|
// modify it under the terms of the GNU General Public License as published
|
19 |
|
|
// by the Free Software Foundation, either version 3 of the License, or (at
|
20 |
|
|
// your option) any later version.
|
21 |
|
|
//
|
22 |
|
|
// This program is distributed in the hope that it will be useful, but WITHOUT
|
23 |
|
|
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
|
24 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
25 |
|
|
// for more details.
|
26 |
|
|
//
|
27 |
|
|
// You should have received a copy of the GNU General Public License along
|
28 |
|
|
// with this program. (It's in the $(ROOT)/doc directory, run make with no
|
29 |
|
|
// target there if the PDF file isn't present.) If not, see
|
30 |
|
|
// <http://www.gnu.org/licenses/> for a copy.
|
31 |
|
|
//
|
32 |
|
|
// License: GPL, v3, as defined and found on www.gnu.org,
|
33 |
|
|
// http://www.gnu.org/licenses/gpl.html
|
34 |
|
|
//
|
35 |
|
|
//
|
36 |
|
|
////////////////////////////////////////////////////////////////////////////////
|
37 |
|
|
//
|
38 |
|
|
//
|
39 |
|
|
#ifndef ZIPCPU_H
|
40 |
|
|
#define ZIPCPU_H
|
41 |
|
|
|
42 |
|
|
#define CC_Z 0x0001
|
43 |
|
|
#define CC_C 0x0002
|
44 |
|
|
#define CC_N 0x0004
|
45 |
|
|
#define CC_V 0x0008
|
46 |
|
|
#define CC_SLEEP 0x0010
|
47 |
|
|
#define CC_GIE 0x0020
|
48 |
|
|
#define CC_STEP 0x0040
|
49 |
|
|
#define CC_BREAK 0x0080
|
50 |
|
|
#define CC_ILL 0x0100
|
51 |
|
|
#define CC_TRAP 0x0200
|
52 |
|
|
#define CC_BUSERR 0x0400
|
53 |
|
|
#define CC_DIVERR 0x0800
|
54 |
|
|
#define CC_FPUERR 0x1000
|
55 |
|
|
#define CC_IPHASE 0x2000
|
56 |
|
|
#define CC_MMUERR 0x8000
|
57 |
|
|
#define CC_FAULT (CC_ILL|CC_BUSERR|CC_DIVERR|CC_FPUERR)
|
58 |
|
|
#define CC_EXCEPTION (CC_BREAK|CC_FAULT|CC_MMUERR)
|
59 |
|
|
|
60 |
|
|
// extern void zip_break(void);
|
61 |
|
|
#define zip_break() asm("BREAK\n")
|
62 |
|
|
// #define BREAK(ID) asm("BREAK " ##ID "\n")
|
63 |
|
|
#define GETUREG(A,ID) asm("MOV " ID ",%0" : "=r"(A))
|
64 |
|
|
#define SETUREG(A,ID) asm("MOV %0," ID : : "r"(A))
|
65 |
|
|
extern void zip_rtu(void);
|
66 |
|
|
extern void zip_halt(void);
|
67 |
|
|
extern void zip_idle(void);
|
68 |
|
|
extern void zip_syscall(void);
|
69 |
|
|
extern void zip_restore_context(int *);
|
70 |
|
|
extern void zip_save_context(int *);
|
71 |
|
|
extern int zip_bitrev(int v);
|
72 |
|
|
extern unsigned zip_cc(void);
|
73 |
|
|
extern unsigned zip_ucc(void);
|
74 |
|
|
|
75 |
|
|
extern void save_context(int *);
|
76 |
|
|
extern void restore_context(int *);
|
77 |
|
|
extern int syscall(int,int,int,int);
|
78 |
|
|
|
79 |
|
|
#ifndef NULL
|
80 |
|
|
#define NULL ((void *)0)
|
81 |
|
|
#endif
|
82 |
|
|
|
83 |
|
|
#define ASMFNSTR(A) "\t.section\t.text\n\t.global\t" A "\n\t.type\t" A ",@function\n" A ":\n"
|
84 |
|
|
|
85 |
|
|
#endif
|