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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [orpsocv2/] [bench/] [verilog/] [vpi/] [c/] [rsp-rtl_sim.h] - Blame information for rev 46

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

Line No. Rev Author Line
1 40 julius
/*$$HEADER*/
2
/******************************************************************************/
3
/*                                                                            */
4
/*                    H E A D E R   I N F O R M A T I O N                     */
5
/*                                                                            */
6
/******************************************************************************/
7
 
8
// Project Name                   : ORPSoCv2
9
// File Name                      : rsp-rtl_sim.h
10
// Prepared By                    : jb, jb@orsoc.se
11
// Project Start                  : 2009-05-01
12
 
13
/*$$COPYRIGHT NOTICE*/
14
/******************************************************************************/
15
/*                                                                            */
16
/*                      C O P Y R I G H T   N O T I C E                       */
17
/*                                                                            */
18
/******************************************************************************/
19
/*
20
  This library is free software; you can redistribute it and/or
21
  modify it under the terms of the GNU Lesser General Public
22
  License as published by the Free Software Foundation;
23
  version 2.1 of the License, a copy of which is available from
24
  http://www.gnu.org/licenses/old-licenses/lgpl-2.1.txt.
25
 
26
  This library is distributed in the hope that it will be useful,
27
  but WITHOUT ANY WARRANTY; without even the implied warranty of
28
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
29
  Lesser General Public License for more details.
30
 
31
  You should have received a copy of the GNU Lesser General Public
32
  License along with this library; if not, write to the Free Software
33
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
34
*/
35
 
36
#ifndef _RSP_RTL_SIM_H_
37
#define _RSP_RTL_SIM_H_
38
 
39
#include <stdint.h> // For uint32_t types
40
 
41
//#define DEBUG 1
42
//#define DEBUG2 1
43
 
44
#define Boolean int
45
#define false 0
46
#define true 1
47
 
48
#ifdef DEBUG
49
#define debug printf
50
#else
51
#define debug
52
#endif
53
 
54
#ifdef DEBUG2
55
#define debug2 printf
56
#else
57
#define debug2
58
#endif
59
 
60
 
61
#define DBG_ON  0
62
 
63 46 julius
#define DBG_JP_VPI 0
64
 
65 40 julius
#define DBG_VPI 0
66
 
67 46 julius
#define DBG_CALLS 0
68 40 julius
 
69 46 julius
extern uint32_t vpi_to_rsp_pipe[2]; // [0] - read, [1] - write
70
extern uint32_t rsp_to_vpi_pipe[2]; // [0] - read, [1] - write
71
extern uint32_t command_pipe[2]; // RSP end writes, VPI end reads ONLY
72
 
73 40 julius
#if (DEBUG) || (DEBUG2)
74
#define flush_debug() fflush(stdout)
75
#else
76
#define flush_debug()
77
#endif
78
 
79
# define JTAG_WAIT() usleep(1000)
80
# define JTAG_RETRY_WAIT() usleep (1000)
81
 
82
/* Selects crc trailer size in bits. Currently supported: 8 */
83
#define CRC_SIZE (8)
84
 
85
/* Scan chain size in bits.  */
86
#define SC_SIZE (4)
87
 
88
/* function to kick off this server */
89
void run_rsp_server(int);
90
 
91
/* read a word from wishbone */
92
int dbg_wb_read32(uint32_t adr, uint32_t *data);
93
 
94
/* write a word to wishbone */
95
int dbg_wb_write32(uint32_t adr, uint32_t data);
96 46 julius
int dbg_wb_write16(uint32_t adr, uint16_t data);
97
int dbg_wb_write8(uint32_t adr, uint8_t data);
98 40 julius
 
99
/* read a block from wishbone */
100
int dbg_wb_read_block32(uint32_t adr, uint32_t *data, int len);
101
 
102
/* write a block to wishbone */
103
int dbg_wb_write_block32(uint32_t adr, uint32_t *data, int len);
104
 
105
/* read a register from cpu */
106
int dbg_cpu0_read(uint32_t adr, uint32_t *data);
107
 
108
/* read a register from cpu module */
109
int dbg_cpu0_read_ctrl(uint32_t adr, unsigned char *data);
110
 
111
/* write a cpu register */
112
int dbg_cpu0_write(uint32_t adr, uint32_t data);
113
 
114
/* write a cpu module register */
115
int dbg_cpu0_write_ctrl(uint32_t adr, unsigned char data);
116
 
117
/* send a message to the sim that the debugging client has disconnected */
118
void dbg_client_detached(void);
119
 
120
#define DC_SIZE           4
121
#define DC_STATUS_SIZE    4
122
 
123
#define DC_WISHBONE       0
124
#define DC_CPU0           1
125
#define DC_CPU1           2
126
 
127
#define DI_GO          0
128
#define DI_READ_CMD    1
129
#define DI_WRITE_CMD   2
130
#define DI_READ_CTRL   3
131
#define DI_WRITE_CTRL  4
132
 
133
#define DBG_CRC_SIZE      32
134
#define DBG_CRC_POLY      0x04c11db7
135
 
136
#define DBG_ERR_OK        0
137
#define DBG_ERR_CRC       8
138
 
139
#define NUM_SOFT_RETRIES  3
140
#define NUM_HARD_RETRIES  3
141
#define NUM_ACCESS_RETRIES 10
142
 
143
/* Possible errors are listed here.  */
144
enum enum_errors  /* modified <chris@asics.ws> CZ 24/05/01 */
145
{
146
  /* Codes > 0 are for system errors */
147
 
148
  ERR_NONE = 0,
149
  ERR_CRC = -1,
150
  ERR_MEM = -2,
151
  JTAG_PROXY_INVALID_COMMAND = -3,
152
  JTAG_PROXY_SERVER_TERMINATED = -4,
153
  JTAG_PROXY_NO_CONNECTION = -5,
154
  JTAG_PROXY_PROTOCOL_ERROR = -6,
155
  JTAG_PROXY_COMMAND_NOT_IMPLEMENTED = -7,
156
  JTAG_PROXY_INVALID_CHAIN = -8,
157
  JTAG_PROXY_INVALID_ADDRESS = -9,
158
  JTAG_PROXY_ACCESS_EXCEPTION = -10, /* Write to ROM */
159
  JTAG_PROXY_INVALID_LENGTH = -11,
160
  JTAG_PROXY_OUT_OF_MEMORY = -12,
161
};
162
 
163
#endif
164
 

powered by: WebSVN 2.1.0

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