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

Subversion Repositories openriscdevboard

[/] [openriscdevboard/] [trunk/] [cyc2-openrisc/] [doc/] [HOWTO_add_new_SantaCruz_daughter_card.txt] - Blame information for rev 5

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

Line No. Rev Author Line
1 2 sfielding
---- Adding new Santa Cruz daughter card peripheral to cyc_or12_mini_top.v ---
2
 
3
--------------------------------------------------------
4
1. Edit the Santa Cruz I/O.
5
--------------------------------------------------------
6
Edit the direction for the Santa Cruz I/O.
7
You will need to edit the following section to ensure that the Santa Cruz I/O
8
is set to the correct direction;
9
 
10
  output SC_P_CLK;
11
  output SC_RST_N;
12
  output SC_CS_N;
13
  input SC_P0;
14
  output SC_P1;
15
  output SC_P2;
16
  ...
17
  output SC_P38;
18
  output SC_P39;
19
 
20
--------------------------------------------------------
21
2. Modify the Wishbone bus interface
22
--------------------------------------------------------
23
If the new peripheral(s) have a Wishbone bus interface then
24
create local interface wires for each new peripheral, eg;
25
//
26
// Santa Cruz SD card i/f wires
27
//
28
wire    [31:0]          wb_sdCard_dat_i;
29
wire    [7:0]           wb_sdCard_dat_8bit;
30
wire    [31:0]          wb_sdCard_dat_o;
31
wire    [31:0]          wb_sdCard_adr_i;
32
wire    [3:0]           wb_sdCard_sel_i;
33
wire                    wb_sdCard_we_i;
34
wire                    wb_sdCard_cyc_i;
35
wire                    wb_sdCard_stb_i;
36
wire                    wb_sdCard_ack_o;
37
 
38
 
39
--------------------------------------------------------
40
3. Add peripheral wire connections
41
--------------------------------------------------------
42
Add local interface wires for each wired connection to
43
the Santa Cruz header, eg;
44
  //
45
  // Santa Cruz SD card
46
  //
47
  wire sdSpiClk;
48
  wire sdSpiMasterDataIn;
49
  wire sdSpiMasterDataOut;
50
  wire sdSpiCS_n;
51
 
52
 
53
--------------------------------------------------------
54
4. Add instance(s) of the new peripheral(s), eg;
55
--------------------------------------------------------
56
 
57
spiMaster u_sdSpiMaster (
58
  //Wishbone bus
59
  .clk_i(wb_clk),
60
  .rst_i(wb_rst),
61
  .address_i(wb_sdCard_adr_i[7:0]),
62
  .data_i(wb_sdCard_dat_i[7:0]),
63
  .data_o(wb_sdCard_dat_8bit),
64
  .strobe_i(wb_sdCard_stb_i),
65
  .we_i(wb_sdCard_we_i),
66
  .ack_o(wb_sdCard_ack_o),
67
  // SPI logic clock
68
  .spiSysClk(clk),
69
  //SPI bus
70
  .spiClkOut(sdSpiClk),
71
  .spiDataIn(sdSpiMasterDataIn),
72
  .spiDataOut(sdSpiMasterDataOut),
73
  .spiCS_n(sdSpiCS_n)
74
);
75
 
76
--------------------------------------------------------
77
5. Configure the address
78
--------------------------------------------------------
79
If the new peripheral(s) have a Wishbone bus interface then
80
modify the parameter block for tc_top to set the address(es) of your new peripheral(s).
81
Typically you will be modifying the offset address of Target 2 through 8
82
 
83
tc_top #(`APP_ADDR_DEC_W,
84
         `APP_ADDR_SRAM,   //Target 0 address
85
         `APP_ADDR_DEC_DRAM_W,
86
         `APP_ADDR_DRAM,   //Target 1 address
87
         `APP_ADDR_DECP_W,
88
         `APP_ADDR_PERIP,  //Target 2-8 address base
89
         `APP_ADDR_DEC_W,
90
         `APP_ADDR_VGA,     //Target 2 address offset
91
         `APP_ADDR_ETH,     //Target 3 address offset
92
         `APP_ADDR_SD_CARD, //Target 4 address offset
93
         `APP_ADDR_UART,    //Target 5 address offset
94
         `APP_ADDR_USB2,    //Target 6 address offset
95
         `APP_ADDR_SD,      //Target 7 address offset
96
         `APP_ADDR_RES2     //Target 8 address offset
97
 
98
--------------------------------------------------------
99
6. Set address constants
100
--------------------------------------------------------
101
Modify the address map in cyc_or12_defines.v to add your new address offsets;
102
 
103
//
104
// Address map
105
//
106
`define APP_ADDR_DEC_W  8
107
`define APP_ADDR_SRAM   `APP_ADDR_DEC_W'h00
108
`define APP_ADDR_DEC_DRAM_W  2
109
`define APP_ADDR_DRAM   `APP_ADDR_DEC_DRAM_W'b01
110
`define APP_ADDR_DECP_W  4
111
`define APP_ADDR_PERIP  `APP_ADDR_DEC_W'h9
112
`define APP_ADDR_VGA    `APP_ADDR_DEC_W'h97
113
`define APP_ADDR_ETH    `APP_ADDR_DEC_W'h92
114
`define APP_ADDR_USB1   `APP_ADDR_DEC_W'h9d
115
`define APP_ADDR_SD_CARD        `APP_ADDR_DEC_W'h9d
116
`define APP_ADDR_UART   `APP_ADDR_DEC_W'h90
117
`define APP_ADDR_USB2   `APP_ADDR_DEC_W'h94
118
`define APP_ADDR_SD     `APP_ADDR_DEC_W'h9e
119
`define APP_ADDR_RES2   `APP_ADDR_DEC_W'h9f
120
 
121
--------------------------------------------------------
122
7. Connect I/O to the Santa Cruz card
123
--------------------------------------------------------
124
Set the assignments required to connect the Santa Cruz I/O to the
125
new peripheral(s), eg;
126
 
127
  assign SC_P_CLK = 1'b0;
128
  assign SC_RST_N = 1'b0;
129
  assign SC_CS_N = 1'b0;
130
  assign sdSpiMasterDataIn = SC_P0;
131
  assign SC_P1 = sdSpiClk;
132
  assign SC_P2 = sdSpiMasterDataOut;
133
  assign SC_P3 = sdSpiCS_n;
134
  assign SC_P4 = 1'b0;
135
  assign SC_P5 = 1'b0;
136
  assign SC_P6 = 1'b0;
137
  assign SC_P7 = 1'b0;
138
  assign SC_P8 = 1'b0;
139
  assign SC_P9 = 1'b0;
140
  assign SC_P10 = 1'b0;
141
  assign SC_P11 = 1'b0;
142
  assign SC_P12 = 1'b0;
143
  assign SC_P13 = 1'b0;
144
  assign SC_P14 = 1'b0;
145
  assign SC_P15 = 1'b0;
146
  assign SC_P16 = 1'b0;
147
  assign SC_P17 = 1'b0;
148
  assign SC_P18 = 1'b0;
149
  assign SC_P19 = 1'b0;
150
  assign SC_P20 = 1'b0;
151
  assign SC_P21 = 1'b0;
152
  assign SC_P22 = 1'b0;
153
  assign SC_P23 = 1'b0;
154
  assign SC_P24 = 1'b0;
155
  assign SC_P25 = 1'b0;
156
  assign SC_P26 = 1'b0;
157
  assign SC_P27 = 1'b0;
158
  assign SC_P28 = 1'b0;
159
  assign SC_P29 = 1'b0;
160
  assign SC_P30 = 1'b0;
161
  assign SC_P31 = 1'b0;
162
  assign SC_P32 = 1'b0;
163
  assign SC_P33 = 1'b0;
164
  assign SC_P34 = 1'b0;
165
  assign SC_P35 = 1'b0;
166
  assign SC_P36 = 1'b0;
167
  assign SC_P37 = 1'b0;
168
  assign SC_P38 = 1'b0;
169
  assign SC_P39 = 1'b0;
170
 
171
 
172
--------------------------------------------------------
173
8. Create a software project.
174
--------------------------------------------------------
175
Finally create a software project to test your new peripheral.
176
 
177
You can use sw/memTest as a basis for your new software project.
178
The memTest software project creates output files that are suitable
179
for use in simulation and hardware. Of course, if you want to target
180
a simulation you will need to create a simulation model of whatever
181
hardware exists on your Santa Cruz daughter card.
182
Add a constant to board.h to define the address of your new periperal, eg;
183
 
184
#define SD_CARD_BASE  0x9d000000
185
 
186
You can access your new periperal using the REG8 etc macros, eg;
187
 
188
REG8(SD_CARD_BASE + SPI_TX_FIFO_DATA_REG) = dataWrite;
189
dataRead = REG8(SD_CARD_BASE + SPI_RX_FIFO_DATA_REG);
190
 
191
 
192
 

powered by: WebSVN 2.1.0

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