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

Subversion Repositories amber

[/] [amber/] [trunk/] [hw/] [vlog/] [system/] [boot_mem128.v] - Blame information for rev 36

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

Line No. Rev Author Line
1 2 csantifort
//////////////////////////////////////////////////////////////////
2
//                                                              //
3
//  8KBytes SRAM configured with boot software                  //
4
//                                                              //
5
//  This file is part of the Amber project                      //
6
//  http://www.opencores.org/project,amber                      //
7
//                                                              //
8
//  Description                                                 //
9
//  Holds just enough software to get the system going.         //
10
//  The boot loader fits into this 8KB embedded SRAM on the     //
11
//  FPGA and enables it to load large applications via the      //
12
//  serial port (UART) into the DDR3 memory                     //
13
//                                                              //
14
//  Author(s):                                                  //
15
//      - Conor Santifort, csantifort.amber@gmail.com           //
16
//                                                              //
17
//////////////////////////////////////////////////////////////////
18
//                                                              //
19
// Copyright (C) 2010 Authors and OPENCORES.ORG                 //
20
//                                                              //
21
// This source file may be used and distributed without         //
22
// restriction provided that this copyright statement is not    //
23
// removed from the file and that any derivative work contains  //
24
// the original copyright notice and the associated disclaimer. //
25
//                                                              //
26
// This source file is free software; you can redistribute it   //
27
// and/or modify it under the terms of the GNU Lesser General   //
28
// Public License as published by the Free Software Foundation; //
29
// either version 2.1 of the License, or (at your option) any   //
30
// later version.                                               //
31
//                                                              //
32
// This source is distributed in the hope that it will be       //
33
// useful, but WITHOUT ANY WARRANTY; without even the implied   //
34
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      //
35
// PURPOSE.  See the GNU Lesser General Public License for more //
36
// details.                                                     //
37
//                                                              //
38
// You should have received a copy of the GNU Lesser General    //
39
// Public License along with this source; if not, download it   //
40
// from http://www.opencores.org/lgpl.shtml                     //
41
//                                                              //
42
//////////////////////////////////////////////////////////////////
43
 
44
 
45 36 csantifort
module boot_mem128 #(
46
parameter WB_DWIDTH   = 128,
47
parameter WB_SWIDTH   = 16,
48
parameter MADDR_WIDTH = 9
49 35 csantifort
)(
50 2 csantifort
input                       i_wb_clk,     // WISHBONE clock
51
 
52
input       [31:0]          i_wb_adr,
53 35 csantifort
input       [WB_SWIDTH-1:0] i_wb_sel,
54 2 csantifort
input                       i_wb_we,
55 35 csantifort
output      [WB_DWIDTH-1:0] o_wb_dat,
56
input       [WB_DWIDTH-1:0] i_wb_dat,
57 2 csantifort
input                       i_wb_cyc,
58
input                       i_wb_stb,
59
output                      o_wb_ack,
60
output                      o_wb_err
61
 
62
);
63
 
64
 
65 36 csantifort
wire                    start_write;
66
wire                    start_read;
67
reg                     start_read_r = 'd0;
68
wire [WB_DWIDTH-1:0]    read_data;
69
wire [WB_DWIDTH-1:0]    write_data;
70
wire [WB_SWIDTH-1:0]    byte_enable;
71
wire [MADDR_WIDTH-1:0]  address;
72 35 csantifort
 
73 36 csantifort
 
74 2 csantifort
// Can't start a write while a read is completing. The ack for the read cycle
75
// needs to be sent first
76 36 csantifort
assign start_write = i_wb_stb &&  i_wb_we && !start_read_r;
77
assign start_read  = i_wb_stb && !i_wb_we && !start_read_r;
78 2 csantifort
 
79
 
80
always @( posedge i_wb_clk )
81 36 csantifort
    start_read_r <= start_read;
82 2 csantifort
 
83
assign o_wb_err = 1'd0;
84
 
85 36 csantifort
assign write_data  = i_wb_dat;
86
assign byte_enable = i_wb_sel;
87
assign o_wb_dat    = read_data;
88
assign address     = i_wb_adr[MADDR_WIDTH+3:4];
89
assign o_wb_ack    = i_wb_stb && ( start_write || start_read_r );
90 35 csantifort
 
91
 
92 2 csantifort
// ------------------------------------------------------
93
// Instantiate SRAMs
94
// ------------------------------------------------------
95
//         
96
`ifdef XILINX_FPGA
97
 
98
    `ifdef XILINX_SPARTAN6_FPGA
99 36 csantifort
        xs6_sram_512x128_byte_en
100 2 csantifort
    `endif
101
    `ifdef XILINX_VIRTEX6_FPGA
102 36 csantifort
        xv6_sram_512x128_byte_en
103 2 csantifort
    `endif
104
 
105
#(
106
// This file holds a software image used for FPGA simulations
107
// This pre-processor syntax works with both the simulator
108
// and ISE, which I couldn't get to work with giving it the
109
// file name as a define.
110
 
111
`ifdef BOOT_MEM_PARAMS_FILE
112
    `include `BOOT_MEM_PARAMS_FILE
113
`else
114
    // default file
115 36 csantifort
    `include "boot-loader_memparams128.v"
116 2 csantifort
`endif
117
 
118
)
119
`endif
120
 
121
`ifndef XILINX_FPGA
122
generic_sram_byte_en
123
#(
124 36 csantifort
    .DATA_WIDTH     ( WB_DWIDTH         ),
125
    .ADDRESS_WIDTH  ( MADDR_WIDTH       )
126 2 csantifort
)
127
`endif
128
u_mem (
129 36 csantifort
    .i_clk          ( i_wb_clk          ),
130
    .i_write_enable ( start_write       ),
131
    .i_byte_enable  ( byte_enable       ),
132
    .i_address      ( address           ),  // 2048 words, 32 bits
133
    .o_read_data    ( read_data         ),
134
    .i_write_data   ( write_data        )
135 2 csantifort
);
136
 
137
 
138
// =======================================================================================
139
// =======================================================================================
140
// =======================================================================================
141
// Non-synthesizable debug code
142
// =======================================================================================
143
 
144
 
145
//synopsys translate_off
146
`ifdef XILINX_SPARTAN6_FPGA
147
    `ifdef BOOT_MEM_PARAMS_FILE
148
        initial
149
            $display("Boot mem file is %s", `BOOT_MEM_PARAMS_FILE );
150
    `endif
151
`endif
152
//synopsys translate_on
153
 
154
endmodule
155
 
156
 
157
 

powered by: WebSVN 2.1.0

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