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

Subversion Repositories 8051

[/] [8051/] [trunk/] [bench/] [verilog/] [oc8051_xrom.v] - Blame information for rev 97

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

Line No. Rev Author Line
1 97 simont
//////////////////////////////////////////////////////////////////////
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  2002/10/17 18:56:13  simont
48
// initial CVS input
49
//
50
//
51
 
52
module oc8051_xrom (rst, clk, addr, data, stb_i, cyc_i, ack_o);
53
 
54
parameter DELAY=5;
55
 
56
 
57
input rst, clk, stb_i, cyc_i;
58
input [15:0] addr;
59
output ack_o;
60
output [31:0] data;
61
 
62
reg ack_o;
63
reg [31:0] data;
64
reg [7:0] buff [0:65535];
65
//reg [7:0] buff [8388607:0];
66
reg [2:0] cnt;
67
integer i;
68
 
69
 
70
initial
71
begin
72
//  for (i=0; i<65536; i=i+1)
73
//    buff [i] = 8'h00;
74
  $readmemh("../../../bench/in/oc8051_xrom.in", buff);
75
end
76
 
77
always @(posedge clk or posedge rst)
78
begin
79
  if (rst) begin
80
    data <= #1 31'h0;
81
    ack_o <= #1 1'b0;
82
  end else if (stb_i && ((DELAY==3'b000) || (cnt==3'b000))) begin
83
    data <= #1 {buff [addr], buff[addr+1], buff[addr+2], buff[addr+3]};
84
    ack_o <= #1 1'b1;
85
  end else
86
    ack_o <= #1 1'b0;
87
end
88
 
89
always @(posedge clk or posedge rst)
90
begin
91
  if (rst)
92
    cnt <= #1 DELAY;
93
  else if (cnt == 3'b000)
94
    cnt <= #1 DELAY;
95
  else if (stb_i)
96
    cnt <= #1 cnt - 3'b001;
97
  else cnt <= #1 DELAY;
98
end
99
 
100
 
101
endmodule
102
 
103
 

powered by: WebSVN 2.1.0

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