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

Subversion Repositories zipcpu

[/] [zipcpu/] [trunk/] [sw/] [zasm/] [sys.i] - Blame information for rev 56

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 13 dgisselq
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
2
;
3
; Filename:     sys.i
4
;
5
; Project:      Zip CPU -- a small, lightweight, RISC CPU soft core
6
;
7
; Purpose:      This is the beginnings of a system wide header file for the
8
;               Zip System.   It describes and declares the peripherals
9
;               that will the be used and referenced by the assembly files.
10
;
11
; Status:       As of August, 2015, I have no confidence that the preprocessor
12
;               can properly include this file.  It certainly cannot handle
13
;               macros (yet).
14
;
15
; Creator:      Dan Gisselquist, Ph.D.
16
;               Gisselquist Tecnology, LLC
17
;
18
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
19
;
20
; Copyright (C) 2015, Gisselquist Technology, LLC
21
;
22
; This program is free software (firmware): you can redistribute it and/or
23
; modify it under the terms of  the GNU General Public License as published
24
; by the Free Software Foundation, either version 3 of the License, or (at
25
; your option) any later version.
26
;
27
; This program is distributed in the hope that it will be useful, but WITHOUT
28
; ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
29
; FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
30
; for more details.
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
        sys.bus         equ     0xc0000000
39
        sys.breaken     equ     0x080
40
        sys.step        equ     0x040
41
        sys.gie         equ     0x020
42
        sys.sleep       equ     0x010
43
        sys.ccv         equ     0x008
44
        sys.ccn         equ     0x004
45
        sys.ccc         equ     0x002
46
        sys.ccz         equ     0x001
47 36 dgisselq
        sys.bus.pic     equ     0x000
48 13 dgisselq
        sys.bus.wdt     equ     0x001
49
        sys.bus.cache   equ     0x002
50
        sys.bus.ctrpic  equ     0x003
51
        sys.bus.tma     equ     0x004
52 46 dgisselq
        sys.bus.tmb     equ     0x005
53
        sys.bus.tmc     equ     0x006
54 13 dgisselq
 
55
 
56
 
57
; Define the location(s) of our peripherals,
58
#define sys.base        0xc0000000
59
#define sys.cache.base  0xc0100000
60
#struct sys
61
        pic
62
        wdt
63
        cache
64
        ctrpic
65
        tma
66
        tmb
67
        tmc
68
        jiffies
69
        mtask
70
        mstl
71
        mpstl
72
        mastl
73
        utask
74
        ustl
75
        upstl
76
        uastl
77
#endstruct
78
; and their associated interrupt vectors ...
79
#define CACHEINT        0x01
80
#define JIFFYINT        0x02    ;
81
#define TMCINT          0x04    ;
82
#define TMBINT          0x08    ;
83
#define TMAINT          0x10    ;
84
#define CTRPICINT       0x20    ; The aux interrupt controller
85
; Masks to send to enable those same vectors
86
#define CACHEINTEN      0x80010000
87
#define JIFFYINTEN      0x80020000
88
#define TMCINTEN        0x80040000
89
#define TMBINTEN        0x80080000
90
#define TMAINTEN        0x80100000
91
#define CTRPICEN        0x80200000
92
; And similar masks to disable them
93
#define CACHEINTDIS     0x00010000
94
#define JIFFYINTDIS     0x00020000
95
#define TMCINTDIS       0x00040000
96
#define TMBINTDIS       0x00080000
97
#define TMAINTDIS       0x00100000
98
#define CTRPICDIS       0x00200000
99
 
100
; Define our condition code bits
101
#define CCZ     0x001
102
#define CCC     0x002
103
#define CCN     0x004
104
#define CCV     0x008
105
#define CCSLEEP 0x010
106
#define CCGIE   0x020
107
#define CCSTEP  0x040
108
#define CCUBRK  0x080
109
 
110
; Now, some macros
111
#define PUSH(RG,SP)     SUB 1,SP                \
112 34 dgisselq
                        STO RG,1(SP)
113
#define POP(RG,SP)      LOD 1(SP),RG            \
114 13 dgisselq
                        ADD 1,SP
115
#define FJSR(LBL,RG)    MOV __here__+2(PC),RG   \
116
                        JMP LBL
117
#define FRET(RG)        MOV RG,PC
118
#define JSR(LBL,RG)     SUB 1,SP                \
119
                        MOV __here__+3(PC),RG   \
120 34 dgisselq
                        STO RG,1(SP)            \
121 13 dgisselq
                        JMP LBL                 \
122
                        ADD 1,SP
123 34 dgisselq
#define RET             LOD 1(SP),PC
124 13 dgisselq
#define SAVE_USER_CONTEXT(DR,AR)                \
125 36 dgisselq
                        MOV -15(uSP),AR         \
126 13 dgisselq
                        MOV     uPC,DR          \
127 36 dgisselq
                        STO     DR,15(AR)       \
128 13 dgisselq
                        MOV     uCC,DR          \
129 34 dgisselq
                        STO     DR,14(AR)       \
130 13 dgisselq
                        MOV     uR12,DR         \
131 34 dgisselq
                        STO     DR,13(AR)       \
132 13 dgisselq
                        MOV     uR11,DR         \
133 34 dgisselq
                        STO     DR,12(AR)       \
134 13 dgisselq
                        MOV     uR10,DR         \
135 34 dgisselq
                        STO     DR,11(AR)       \
136 13 dgisselq
                        MOV     uR9,DR          \
137 34 dgisselq
                        STO     DR,10(AR)       \
138 13 dgisselq
                        MOV     uR8,DR          \
139 34 dgisselq
                        STO     DR,9(AR)        \
140 13 dgisselq
                        MOV     uR7,DR          \
141 34 dgisselq
                        STO     DR,8(AR)        \
142 13 dgisselq
                        MOV     uR6,DR          \
143 34 dgisselq
                        STO     DR,7(AR)        \
144 13 dgisselq
                        MOV     uR5,DR          \
145 34 dgisselq
                        STO     DR,6(AR)        \
146 13 dgisselq
                        MOV     uR4,DR          \
147 34 dgisselq
                        STO     DR,5(AR)        \
148 13 dgisselq
                        MOV     uR3,DR          \
149 34 dgisselq
                        STO     DR,4(AR)        \
150 13 dgisselq
                        MOV     uR2,DR          \
151 34 dgisselq
                        STO     DR,3(AR)        \
152 13 dgisselq
                        MOV     uR1,DR          \
153 34 dgisselq
                        STO     DR,2(AR)        \
154 13 dgisselq
                        MOV     uR0,DR          \
155 34 dgisselq
                        STO     DR,1(AR)
156 13 dgisselq
#define RESTORE_USER_CONTEXT(DR,AR)             \
157 34 dgisselq
                        LOD     1(AR),DR        \
158 13 dgisselq
                        MOV     DR,uR0          \
159 34 dgisselq
                        LOD     2(AR),DR        \
160 13 dgisselq
                        MOV     DR,uR1          \
161 34 dgisselq
                        LOD     3(AR),DR        \
162 13 dgisselq
                        MOV     DR,uR2          \
163 34 dgisselq
                        LOD     4(AR),DR        \
164 13 dgisselq
                        MOV     DR,uR3          \
165 34 dgisselq
                        LOD     5(AR),DR        \
166 13 dgisselq
                        MOV     DR,uR4          \
167 34 dgisselq
                        LOD     6(AR),DR        \
168 13 dgisselq
                        MOV     DR,uR5          \
169 34 dgisselq
                        LOD     7(AR),DR        \
170 13 dgisselq
                        MOV     DR,uR6          \
171 34 dgisselq
                        LOD     8(AR),DR        \
172 13 dgisselq
                        MOV     DR,uR7          \
173 34 dgisselq
                        LOD     9(AR),DR        \
174 13 dgisselq
                        MOV     DR,uR8          \
175 34 dgisselq
                        LOD     10(AR),DR       \
176 13 dgisselq
                        MOV     DR,uR9          \
177 34 dgisselq
                        LOD     11(AR),DR       \
178 13 dgisselq
                        MOV     DR,uR10         \
179 34 dgisselq
                        LOD     12(AR),DR       \
180 13 dgisselq
                        MOV     DR,uR11         \
181 34 dgisselq
                        LOD     13(AR),DR       \
182 13 dgisselq
                        MOV     DR,uR12         \
183 34 dgisselq
                        LOD     14(AR),DR       \
184 36 dgisselq
                        MOV     DR,uCC          \
185 34 dgisselq
                        LOD     15(AR),DR       \
186 13 dgisselq
                        MOV     DR,uPC
187
#define READ_USER_TRAP(RG)                      \
188
                        MOV     uCC,RG          \
189
                        AND     -256,RG
190
 

powered by: WebSVN 2.1.0

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