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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [verif/] [model/] [oc8051_xrom.v] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 exteranl program rom                                   ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   external program rom for 8051 core                         ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   Nothing                                                    ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Simon Teran, simont@opencores.org                     ////
16
////                                                              ////
17
//////////////////////////////////////////////////////////////////////
18
////                                                              ////
19
//// Copyright (C) 2000 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
// CVS Revision History
45
//
46
// $Log: not supported by cvs2svn $
47
// Revision 1.1  2003/04/02 11:38:40  simont
48
// initial inport
49
//
50
// Revision 1.1  2002/10/17 18:56:13  simont
51
// initial CVS input
52
//
53
//
54
 
55
module oc8051_xrom (rst, clk, addr, data, stb_i, cyc_i, ack_o);
56
 
57
parameter DELAY=5;
58
 
59
 
60
input rst, clk, stb_i, cyc_i;
61
input [15:0] addr;
62
output ack_o;
63
output [31:0] data;
64
 
65
 
66
reg ack_o;
67
reg [31:0] data;
68
 
69
reg [7:0] buff [0:65535];
70
//reg [7:0] buff [8388607:0];
71
reg [2:0] cnt;
72
integer i;
73
 
74
 
75
wire [7:0] buff_0 = buff [0];
76
wire [7:0] buff_1 = buff [1];
77
wire [7:0] buff_2 = buff [2];
78
wire [7:0] buff_3 = buff [3];
79
 
80
initial
81
begin
82
//  for (i=0; i<65536; i=i+1)
83
//    buff [i] = 8'h00;
84
  $readmemh("./dat/oc8051_xrom.in", buff);
85
  for (i=0; i<10; i=i+1)
86
    $display("i : %h",buff [i] );
87
end
88
 
89
always @(posedge clk or posedge rst)
90
begin
91
  if (rst) begin
92
    data <= #1 31'h0;
93
    ack_o <= #1 1'b0;
94
  end else if (stb_i && ((DELAY==3'b000) || (cnt==3'b000))) begin
95
    data <= #1 {buff[addr+3], buff[addr+2], buff[addr+1], buff [addr]};
96
    ack_o <= #1 1'b1;
97
  end else
98
    ack_o <= #1 1'b0;
99
end
100
 
101
always @(posedge clk or posedge rst)
102
begin
103
  if (rst)
104
    cnt <= #1 DELAY;
105
  else if (cnt == 3'b000)
106
    cnt <= #1 DELAY;
107
  else if (stb_i)
108
    cnt <= #1 cnt - 3'b001;
109
  else cnt <= #1 DELAY;
110
end
111
 
112
endmodule
113
 
114
 

powered by: WebSVN 2.1.0

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