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

Subversion Repositories xulalx25soc

[/] [xulalx25soc/] [trunk/] [sw/] [regdefs.cpp] - Blame information for rev 50

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

Line No. Rev Author Line
1 5 dgisselq
////////////////////////////////////////////////////////////////////////////////
2
//
3
// Filename:    regdefs.cpp
4
//
5
// Project:     XuLA2 board
6
//
7
// Purpose:     To give human readable names to the various registers available
8
//              internal to the processor on the wishbone bus.  This file is
9
//      primarily used for name to number translation within wbregs.cpp.
10
//      All names for a given register are equivalent, save only that the
11
//      register will always be identified by its first name in any output.
12
//
13
//
14
// Creator:     Dan Gisselquist, Ph.D.
15
//              Gisselquist Technology, LLC
16
//
17
////////////////////////////////////////////////////////////////////////////////
18
//
19
// Copyright (C) 2015, Gisselquist Technology, LLC
20
//
21
// This program is free software (firmware): you can redistribute it and/or
22
// modify it under the terms of  the GNU General Public License as published
23
// by the Free Software Foundation, either version 3 of the License, or (at
24
// your option) any later version.
25
//
26
// This program is distributed in the hope that it will be useful, but WITHOUT
27
// ANY WARRANTY; without even the implied warranty of MERCHANTIBILITY or
28
// FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
29
// for more details.
30
//
31
// License:     GPL, v3, as defined and found on www.gnu.org,
32
//              http://www.gnu.org/licenses/gpl.html
33
//
34
//
35
////////////////////////////////////////////////////////////////////////////////
36
//
37
//
38
#include <stdio.h>
39
#include <stdlib.h>
40
#include <strings.h>
41
#include <ctype.h>
42
#include "regdefs.h"
43
 
44
const   REGNAME raw_bregs[] = {
45
        // { R_RESET,   "RESET"                 },
46
        // { R_STATUS,  "STATUS"                },
47
        // { R_CONTROL, "CONTROL"               },
48
        { R_VERSION,    "VERSION"               },
49
        { R_ICONTROL,   "ICONTROL"              },
50
        { R_ICONTROL,   "INT"                   },
51
        { R_ICONTROL,   "PIC"                   },
52
        { R_ICONTROL,   "INTC"                  },
53
        { R_BUSERR,     "BUSERR"                },
54
        { R_BUSERR,     "BUS"                   },
55
        { R_DATE,       "DATE"                  },
56
        { R_GPIO,       "GPIO"                  },
57
        { R_UART_CTRL,  "UARTCTRL"              },
58
        { R_UART_CTRL,  "UART"                  },
59 31 dgisselq
        { R_PWM_INTERVAL,"PWMCTRL"              },
60 5 dgisselq
        { R_PWM_INTERVAL,"PWMI"                 },
61
        { R_PWM_DATA,   "PWMDATA"               },
62
        { R_PWM_DATA,   "PWM"                   },
63 31 dgisselq
        { R_PWM_DATA,   "PWMAUDIO"              },
64
        { R_PWM_DATA,   "AUDIO"                 },
65 5 dgisselq
        { R_UART_RX,    "UART-RX"               },
66 31 dgisselq
        { R_UART_RX,    "UARTRX"                },
67 5 dgisselq
        { R_UART_RX,    "RX"                    },
68
        { R_UART_TX,    "UART-TX"               },
69 31 dgisselq
        { R_UART_TX,    "UARTTX"                },
70 5 dgisselq
        { R_UART_TX,    "TX"                    },
71
        //
72
        { R_SPIF_EREG,  "SPIFEREG"              },
73
        { R_SPIF_EREG,  "SPIFE"                 },
74
        { R_SPIF_CREG,  "SPIFCONF"              },
75
        { R_SPIF_CREG,  "SPIFC"                 },
76
        { R_SPIF_SREG,  "SPIFSTAT"              },
77
        { R_SPIF_SREG,  "SPIFS"                 },
78
        { R_SPIF_IDREG, "SPIFID"                },
79
        { R_SPIF_IDREG, "SPIFI"                 },
80
        //
81
        { R_CLOCK,      "CLOCK"                 },
82
        { R_CLOCK,      "TIME"                  },
83
        { R_TIMER,      "TIMER"                 },
84
        { R_STOPWATCH,  "STOPWACH"              },
85
        { R_STOPWATCH,  "STOPWATCH"             },
86
        { R_CKALARM,    "CKALARM"               },
87
        { R_CKALARM,    "ALARM"                 },
88
        { R_CKSPEED,    "CKSPEED"               },
89
        // Scopes are defined and come and go.  Be aware, therefore, not all
90
        // of these scopes may be defined at the same time.
91
        { R_QSCOPE,     "SCOPE"                 },
92
        { R_QSCOPE,     "SCOP"                  },
93
        { R_QSCOPED,    "SCOPDATA"              },
94
        { R_QSCOPED,    "SCDATA"                },
95
        { R_CFGSCOPE,   "CFGSCOPE"              },
96
        { R_CFGSCOPE,   "CFGSCOP"               },
97
        { R_CFGSCOPED,  "CFGSCOPD"              },
98
        { R_CPUSCOPED,  "CPUSCOPD"              },
99
        { R_RAMSCOPE,   "MEMSCOPE"              },
100
        { R_RAMSCOPE,   "MEMSCOP"               },
101
        { R_RAMSCOPED,  "MEMSCOPD"              },
102
        { R_RAMSCOPE,   "RAMSCOPE"              },
103
        { R_RAMSCOPE,   "RAMSCOP"               },
104
        { R_RAMSCOPED,  "RAMSCOPD"              },
105 17 dgisselq
        { R_CPUSCOPE,   "CPUSCOPE"              },
106
        { R_CPUSCOPE,   "CPUSCOP"               },
107 5 dgisselq
        //
108
        // For working with the ICAPE interface ... if I can ever get a
109
        // testing environment suitable to prove that it works.
110
        //
111
        { R_CFG_CRC,    "FPGACRC"               },
112
        { R_CFG_FAR_MAJ, "FPGAFARH"             },
113
        { R_CFG_FAR_MIN, "FPGAFARL"             },
114
        { R_CFG_FDRI,   "FPGAFDRI"              },
115
        { R_CFG_FDRO,   "FPGAFDRO"              },
116
        { R_CFG_CMD,    "FPGACMD"               },
117
        { R_CFG_CTL,    "FPGACTL"               },
118
        { R_CFG_MASK,   "FPGAMASK"              },
119
        { R_CFG_STAT,   "FPGASTAT"              },
120
        { R_CFG_LOUT,   "FPGALOUT"              },
121
        { R_CFG_COR1,   "FPGACOR1"              },
122
        { R_CFG_COR2,   "FPGACOR2"              },
123
        { R_CFG_PWRDN,  "FPGAPWRDN"             },
124
        { R_CFG_FLR,    "FPGAFLR"               },
125
        { R_CFG_IDCODE, "FPGAIDCODE"            },
126
        { R_CFG_CWDT,   "FPGACWDT"              },
127
        { R_CFG_HCOPT,  "FPGAHCOPT"             },
128
        { R_CFG_CSBO,   "FPGACSBO"              },
129
        { R_CFG_GEN1,   "FPGAGEN1"              },
130
        { R_CFG_GEN2,   "FPGAGEN2"              },
131
        { R_CFG_GEN3,   "FPGAGEN3"              },
132
        { R_CFG_GEN4,   "FPGAGEN4"              },
133
        { R_CFG_GEN5,   "FPGAGEN5"              },
134
        { R_CFG_MODE,   "FPGAMODE"              },
135
        { R_CFG_GWE,    "FPGAGWE"               },
136
        { R_CFG_GTS,    "FPGAGTS"               },
137
        { R_CFG_MFWR,   "FPGAMFWR"              },
138
        { R_CFG_CCLK,   "FPGACCLK"              },
139
        { R_CFG_SEU,    "FPGASEU"               },
140
        { R_CFG_EXP,    "FPGAEXP"               },
141
        { R_CFG_RDBK,   "FPGARDBK"              },
142
        { R_CFG_BOOTSTS, "BOOTSTS"              },
143
        { R_CFG_EYE,    "FPGAEYE"               },
144
        { R_CFG_CBC,    "FPGACBC"               },
145
        //
146
        //
147
        { R_ZIPCTRL,    "ZIPCTRL"               },
148
        { R_ZIPCTRL,    "ZIPC"                  },
149
        { R_ZIPCTRL,    "CPU"                   },
150
        { R_ZIPCTRL,    "CPUC"                  },
151
        { R_ZIPDATA,    "ZIPDATA"               },
152
        { R_ZIPDATA,    "ZIPD"                  },
153
        { R_ZIPDATA,    "CPUD"                  },
154
        //
155
        { RAMBASE,      "MEM"                   },
156
        { SPIFLASH,     "FLASH"                 },
157
        { SDRAMBASE,    "SDRAM"                 },
158
        { SDRAMBASE,    "RAM"                   }
159
};
160
 
161
#define RAW_NREGS       (sizeof(raw_bregs)/sizeof(bregs[0]))
162
 
163
const   REGNAME *bregs = raw_bregs;
164
const   int     NREGS = RAW_NREGS;
165
 
166
unsigned        addrdecode(const char *v) {
167
        if (isalpha(v[0])) {
168
                for(int i=0; i<NREGS; i++)
169
                        if (strcasecmp(v, bregs[i].m_name)==0)
170
                                return bregs[i].m_addr;
171
                fprintf(stderr, "Unknown register: %s\n", v);
172
                exit(-2);
173
        } else
174
                return strtoul(v, NULL, 0);
175
}
176
 
177
const   char *addrname(const unsigned v) {
178
        for(int i=0; i<NREGS; i++)
179
                if (bregs[i].m_addr == v)
180
                        return bregs[i].m_name;
181
        return NULL;
182
}
183
 

powered by: WebSVN 2.1.0

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