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

Subversion Repositories xulalx25soc

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

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
        { R_PWM_INTERVAL,"PWMI"                 },
60
        { R_PWM_DATA,   "PWMDATA"               },
61
        { R_PWM_DATA,   "PWM"                   },
62
        { R_UART_RX,    "UART-RX"               },
63
        { R_UART_RX,    "RX"                    },
64
        { R_UART_TX,    "UART-TX"               },
65
        { R_UART_TX,    "TX"                    },
66
        //
67
        { R_SPIF_EREG,  "SPIFEREG"              },
68
        { R_SPIF_EREG,  "SPIFE"                 },
69
        { R_SPIF_CREG,  "SPIFCONF"              },
70
        { R_SPIF_CREG,  "SPIFC"                 },
71
        { R_SPIF_SREG,  "SPIFSTAT"              },
72
        { R_SPIF_SREG,  "SPIFS"                 },
73
        { R_SPIF_IDREG, "SPIFID"                },
74
        { R_SPIF_IDREG, "SPIFI"                 },
75
        //
76
        { R_CLOCK,      "CLOCK"                 },
77
        { R_CLOCK,      "TIME"                  },
78
        { R_TIMER,      "TIMER"                 },
79
        { R_STOPWATCH,  "STOPWACH"              },
80
        { R_STOPWATCH,  "STOPWATCH"             },
81
        { R_CKALARM,    "CKALARM"               },
82
        { R_CKALARM,    "ALARM"                 },
83
        { R_CKSPEED,    "CKSPEED"               },
84
        // Scopes are defined and come and go.  Be aware, therefore, not all
85
        // of these scopes may be defined at the same time.
86
        { R_QSCOPE,     "SCOPE"                 },
87
        { R_QSCOPE,     "SCOP"                  },
88
        { R_QSCOPED,    "SCOPDATA"              },
89
        { R_QSCOPED,    "SCDATA"                },
90
        { R_CFGSCOPE,   "CFGSCOPE"              },
91
        { R_CFGSCOPE,   "CFGSCOP"               },
92
        { R_CFGSCOPED,  "CFGSCOPD"              },
93
        { R_CPUSCOPED,  "CPUSCOPD"              },
94
        { R_RAMSCOPE,   "MEMSCOPE"              },
95
        { R_RAMSCOPE,   "MEMSCOP"               },
96
        { R_RAMSCOPED,  "MEMSCOPD"              },
97
        { R_RAMSCOPE,   "RAMSCOPE"              },
98
        { R_RAMSCOPE,   "RAMSCOP"               },
99
        { R_RAMSCOPED,  "RAMSCOPD"              },
100 17 dgisselq
        { R_CPUSCOPE,   "CPUSCOPE"              },
101
        { R_CPUSCOPE,   "CPUSCOP"               },
102 5 dgisselq
        //
103
        // For working with the ICAPE interface ... if I can ever get a
104
        // testing environment suitable to prove that it works.
105
        //
106
        { R_CFG_CRC,    "FPGACRC"               },
107
        { R_CFG_FAR_MAJ, "FPGAFARH"             },
108
        { R_CFG_FAR_MIN, "FPGAFARL"             },
109
        { R_CFG_FDRI,   "FPGAFDRI"              },
110
        { R_CFG_FDRO,   "FPGAFDRO"              },
111
        { R_CFG_CMD,    "FPGACMD"               },
112
        { R_CFG_CTL,    "FPGACTL"               },
113
        { R_CFG_MASK,   "FPGAMASK"              },
114
        { R_CFG_STAT,   "FPGASTAT"              },
115
        { R_CFG_LOUT,   "FPGALOUT"              },
116
        { R_CFG_COR1,   "FPGACOR1"              },
117
        { R_CFG_COR2,   "FPGACOR2"              },
118
        { R_CFG_PWRDN,  "FPGAPWRDN"             },
119
        { R_CFG_FLR,    "FPGAFLR"               },
120
        { R_CFG_IDCODE, "FPGAIDCODE"            },
121
        { R_CFG_CWDT,   "FPGACWDT"              },
122
        { R_CFG_HCOPT,  "FPGAHCOPT"             },
123
        { R_CFG_CSBO,   "FPGACSBO"              },
124
        { R_CFG_GEN1,   "FPGAGEN1"              },
125
        { R_CFG_GEN2,   "FPGAGEN2"              },
126
        { R_CFG_GEN3,   "FPGAGEN3"              },
127
        { R_CFG_GEN4,   "FPGAGEN4"              },
128
        { R_CFG_GEN5,   "FPGAGEN5"              },
129
        { R_CFG_MODE,   "FPGAMODE"              },
130
        { R_CFG_GWE,    "FPGAGWE"               },
131
        { R_CFG_GTS,    "FPGAGTS"               },
132
        { R_CFG_MFWR,   "FPGAMFWR"              },
133
        { R_CFG_CCLK,   "FPGACCLK"              },
134
        { R_CFG_SEU,    "FPGASEU"               },
135
        { R_CFG_EXP,    "FPGAEXP"               },
136
        { R_CFG_RDBK,   "FPGARDBK"              },
137
        { R_CFG_BOOTSTS, "BOOTSTS"              },
138
        { R_CFG_EYE,    "FPGAEYE"               },
139
        { R_CFG_CBC,    "FPGACBC"               },
140
        //
141
        //
142
        { R_ZIPCTRL,    "ZIPCTRL"               },
143
        { R_ZIPCTRL,    "ZIPC"                  },
144
        { R_ZIPCTRL,    "CPU"                   },
145
        { R_ZIPCTRL,    "CPUC"                  },
146
        { R_ZIPDATA,    "ZIPDATA"               },
147
        { R_ZIPDATA,    "ZIPD"                  },
148
        { R_ZIPDATA,    "CPUD"                  },
149
        //
150
        { RAMBASE,      "MEM"                   },
151
        { SPIFLASH,     "FLASH"                 },
152
        { SDRAMBASE,    "SDRAM"                 },
153
        { SDRAMBASE,    "RAM"                   }
154
};
155
 
156
#define RAW_NREGS       (sizeof(raw_bregs)/sizeof(bregs[0]))
157
 
158
const   REGNAME *bregs = raw_bregs;
159
const   int     NREGS = RAW_NREGS;
160
 
161
unsigned        addrdecode(const char *v) {
162
        if (isalpha(v[0])) {
163
                for(int i=0; i<NREGS; i++)
164
                        if (strcasecmp(v, bregs[i].m_name)==0)
165
                                return bregs[i].m_addr;
166
                fprintf(stderr, "Unknown register: %s\n", v);
167
                exit(-2);
168
        } else
169
                return strtoul(v, NULL, 0);
170
}
171
 
172
const   char *addrname(const unsigned v) {
173
        for(int i=0; i<NREGS; i++)
174
                if (bregs[i].m_addr == v)
175
                        return bregs[i].m_name;
176
        return NULL;
177
}
178
 

powered by: WebSVN 2.1.0

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