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 433

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

powered by: WebSVN 2.1.0

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