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

Subversion Repositories thor

[/] [thor/] [trunk/] [bench/] [bootrom.v] - Blame information for rev 30

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

Line No. Rev Author Line
1 2 robfinch
`timescale 1ns / 1ps
2
// ============================================================================
3
//        __
4
//   \\__/ o\    (C) 2012-2013  Robert Finch, Stratford
5
//    \  __ /    All rights reserved.
6
//     \/_//     robfinch<remove>@opencores.org
7
//       ||
8
//
9
// This source file is free software: you can redistribute it and/or modify 
10
// it under the terms of the GNU Lesser General Public License as published 
11
// by the Free Software Foundation, either version 3 of the License, or     
12
// (at your option) any later version.                                      
13
//                                                                          
14
// This source file is distributed in the hope that it will be useful,      
15
// but WITHOUT ANY WARRANTY; without even the implied warranty of           
16
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the            
17
// GNU General Public License for more details.                             
18
//                                                                          
19
// You should have received a copy of the GNU General Public License        
20
// along with this program.  If not, see <http://www.gnu.org/licenses/>.    
21
//
22
// ============================================================================
23
//
24 21 robfinch
module bootrom(rst_i, clk_i, cti_i, cyc_i, stb_i, ack_o, adr_i, dat_o, perr, err1, err2);
25 2 robfinch
parameter DBW=64;
26
parameter MAGIC1=32'hAAAAAAAA;
27
parameter MAGIC2=32'h55555555;
28
input rst_i;
29
input clk_i;
30
input [2:0] cti_i;
31
input cyc_i;
32
input stb_i;
33
output ack_o;
34
input [31:0] adr_i;
35 21 robfinch
output [DBW+6:0] dat_o;
36
reg [DBW+6:0] dat_o;
37 2 robfinch
output perr;
38 21 robfinch
output err1;
39
output err2;
40 2 robfinch
 
41
wire ne_cs;
42
wire cs;
43
reg ack0,ack1,ack2,ack3;
44
always @(posedge clk_i)
45
begin
46
        if (ne_cs)
47
                ack0 <= cs;
48
        else if (!cs)
49
                ack0 <= 1'b0;
50
        ack1 <= ack0 & cs;
51
        ack2 <= ack1 & cs;
52
        ack3 <= ack2 & cs;
53
end
54 21 robfinch
assign cs = cyc_i && stb_i && adr_i[31:20]==12'hFFF;
55 2 robfinch
assign ack_o = cs & ack0;
56
 
57 21 robfinch
reg [38:0] rommem0 [0:25599];
58
//reg [DBW-1:0] rommem1 [0:7167];
59
//reg [DBW-1:0] rommem2 [0:7167];
60 2 robfinch
initial begin
61
if (DBW==32) begin
62 21 robfinch
`include "..\..\software\source\boot.ve0"
63
//`include "..\..\software\A64\bin\boot.ve1"
64
//`include "..\..\software\A64\bin\boot.ve2"
65 2 robfinch
end
66
else begin
67 21 robfinch
`include "..\..\software\source\boot.ve0"
68
//`include "..\..\software\A64\bin\boot.ve1"
69
//`include "..\..\software\A64\bin\boot.ve2"
70 2 robfinch
end
71
end
72
 
73
wire pe_cs;
74
edge_det u1 (.rst(rst_i), .clk(clk_i), .ce(1'b1), .i(cs), .pe(pe_cs), .ne(), .ee());
75
edge_det u2 (.rst(rst_i), .clk(clk_i), .ce(1'b1), .i(pe_cs), .pe(), .ne(ne_cs), .ee());
76
 
77
reg [14:2] radr;
78
reg [14:2] ctr;
79
 
80
always @(posedge clk_i)
81
        if (pe_cs) begin
82
                if (DBW==32)
83
                        ctr <= adr_i[14:2] + 13'd1;
84
                else
85
                        ctr <= adr_i[14:3] + 13'd1;
86
        end
87
        else if (cs)
88
                ctr <= ctr + 13'd1;
89
 
90
always @(posedge clk_i)
91
        if (DBW==32)
92
                radr <= pe_cs ? adr_i[14:2] : ctr;
93
        else
94
                radr <= pe_cs ? adr_i[14:3] : ctr;
95
 
96 21 robfinch
wire [38:0] d0 = rommem0[radr];
97
//wire [31:0] d1 = rommem1[radr][DBW-1:0]^MAGIC1;
98
//wire [31:0] d2 = rommem2[radr][DBW-1:0]^MAGIC2;
99
wire [31:0] d4;//(d0&d1)|(d0&d2)|(d1&d2);
100 2 robfinch
 
101 21 robfinch
//ECC ecc1(d0,d4);
102
ecc_0 uecc1 (
103
  .ecc_correct_n(1'b0),    // input wire ecc_correct_n
104
  .ecc_data_in(d0[31:0]),        // input wire [31 : 0] ecc_data_in
105
  .ecc_data_out(d4),      // output wire [31 : 0] ecc_data_out
106
  .ecc_chkbits_in({d0[37:32],d0[38]}),  // input wire [6 : 0] ecc_chkbits_in
107
  .ecc_sbit_err(err1),      // output wire ecc_sbit_err
108
  .ecc_dbit_err(err2)      // output wire ecc_dbit_err
109
);
110
 
111
 
112 2 robfinch
always @(posedge clk_i)
113
        if (cs) begin
114 21 robfinch
                dat_o <= {d0[38:32],d4};
115 2 robfinch
                $display("br read: %h %h", radr,d4);
116
        end
117
        else
118 21 robfinch
                dat_o <= {DBW+6{1'b0}};
119 2 robfinch
 
120 21 robfinch
/*
121 2 robfinch
always @(posedge clk_i)
122
        if (cs)
123
                perr <= ^rommem0[radr][DBW-1:0]!=rommem0[radr][DBW];
124
        else
125
                perr <= 1'd0;
126 21 robfinch
*/
127
assign perr = 1'b0;
128 2 robfinch
 
129
endmodule

powered by: WebSVN 2.1.0

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