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 40

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
#define DBG_VPI 0
64
 
65
extern int vpi_to_rsp_pipe[2]; // [0] - read, [1] - write
66
extern int rsp_to_vpi_pipe[2]; // [0] - read, [1] - write
67
extern int command_pipe[2]; // RSP end writes, VPI end reads ONLY
68
 
69
#if (DEBUG) || (DEBUG2)
70
#define flush_debug() fflush(stdout)
71
#else
72
#define flush_debug()
73
#endif
74
 
75
# define JTAG_WAIT() usleep(1000)
76
# define JTAG_RETRY_WAIT() usleep (1000)
77
 
78
/* Selects crc trailer size in bits. Currently supported: 8 */
79
#define CRC_SIZE (8)
80
 
81
/* Scan chain size in bits.  */
82
#define SC_SIZE (4)
83
 
84
/* function to kick off this server */
85
void run_rsp_server(int);
86
 
87
/* read a word from wishbone */
88
int dbg_wb_read32(uint32_t adr, uint32_t *data);
89
 
90
/* write a word to wishbone */
91
int dbg_wb_write32(uint32_t adr, uint32_t data);
92
 
93
/* read a block from wishbone */
94
int dbg_wb_read_block32(uint32_t adr, uint32_t *data, int len);
95
 
96
/* write a block to wishbone */
97
int dbg_wb_write_block32(uint32_t adr, uint32_t *data, int len);
98
 
99
/* read a register from cpu */
100
int dbg_cpu0_read(uint32_t adr, uint32_t *data);
101
 
102
/* read a register from cpu module */
103
int dbg_cpu0_read_ctrl(uint32_t adr, unsigned char *data);
104
 
105
/* write a cpu register */
106
int dbg_cpu0_write(uint32_t adr, uint32_t data);
107
 
108
/* write a cpu module register */
109
int dbg_cpu0_write_ctrl(uint32_t adr, unsigned char data);
110
 
111
/* send a message to the sim that the debugging client has disconnected */
112
void dbg_client_detached(void);
113
 
114
#define DC_SIZE           4
115
#define DC_STATUS_SIZE    4
116
 
117
#define DC_WISHBONE       0
118
#define DC_CPU0           1
119
#define DC_CPU1           2
120
 
121
#define DI_GO          0
122
#define DI_READ_CMD    1
123
#define DI_WRITE_CMD   2
124
#define DI_READ_CTRL   3
125
#define DI_WRITE_CTRL  4
126
 
127
#define DBG_CRC_SIZE      32
128
#define DBG_CRC_POLY      0x04c11db7
129
 
130
#define DBG_ERR_OK        0
131
#define DBG_ERR_CRC       8
132
 
133
#define NUM_SOFT_RETRIES  3
134
#define NUM_HARD_RETRIES  3
135
#define NUM_ACCESS_RETRIES 10
136
 
137
/* Possible errors are listed here.  */
138
enum enum_errors  /* modified <chris@asics.ws> CZ 24/05/01 */
139
{
140
  /* Codes > 0 are for system errors */
141
 
142
  ERR_NONE = 0,
143
  ERR_CRC = -1,
144
  ERR_MEM = -2,
145
  JTAG_PROXY_INVALID_COMMAND = -3,
146
  JTAG_PROXY_SERVER_TERMINATED = -4,
147
  JTAG_PROXY_NO_CONNECTION = -5,
148
  JTAG_PROXY_PROTOCOL_ERROR = -6,
149
  JTAG_PROXY_COMMAND_NOT_IMPLEMENTED = -7,
150
  JTAG_PROXY_INVALID_CHAIN = -8,
151
  JTAG_PROXY_INVALID_ADDRESS = -9,
152
  JTAG_PROXY_ACCESS_EXCEPTION = -10, /* Write to ROM */
153
  JTAG_PROXY_INVALID_LENGTH = -11,
154
  JTAG_PROXY_OUT_OF_MEMORY = -12,
155
};
156
 
157
#endif
158
 

powered by: WebSVN 2.1.0

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