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

Subversion Repositories 8051

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

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 157 simont
// Revision 1.1  2003/04/02 11:38:40  simont
48
// initial inport
49
//
50 97 simont
// 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 157 simont
 
66 97 simont
reg ack_o;
67
reg [31:0] data;
68 157 simont
 
69 97 simont
reg [7:0] buff [0:65535];
70
//reg [7:0] buff [8388607:0];
71
reg [2:0] cnt;
72
integer i;
73
 
74
 
75
initial
76
begin
77
//  for (i=0; i<65536; i=i+1)
78
//    buff [i] = 8'h00;
79
  $readmemh("../../../bench/in/oc8051_xrom.in", buff);
80
end
81
 
82
always @(posedge clk or posedge rst)
83
begin
84
  if (rst) begin
85
    data <= #1 31'h0;
86
    ack_o <= #1 1'b0;
87
  end else if (stb_i && ((DELAY==3'b000) || (cnt==3'b000))) begin
88 157 simont
    data <= #1 {buff[addr+3], buff[addr+2], buff[addr+1], buff [addr]};
89 97 simont
    ack_o <= #1 1'b1;
90
  end else
91
    ack_o <= #1 1'b0;
92
end
93
 
94
always @(posedge clk or posedge rst)
95
begin
96
  if (rst)
97
    cnt <= #1 DELAY;
98
  else if (cnt == 3'b000)
99
    cnt <= #1 DELAY;
100
  else if (stb_i)
101
    cnt <= #1 cnt - 3'b001;
102
  else cnt <= #1 DELAY;
103
end
104
 
105
endmodule
106
 
107
 

powered by: WebSVN 2.1.0

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