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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [verif/] [model/] [oc8051_xrom.v] - Blame information for rev 57

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

Line No. Rev Author Line
1 15 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 57 dinesha
`timescale  1ns/1ps
56 15 dinesha
module oc8051_xrom (rst, clk, addr, data, stb_i, cyc_i, ack_o);
57
 
58
parameter DELAY=5;
59
 
60
 
61
input rst, clk, stb_i, cyc_i;
62
input [15:0] addr;
63
output ack_o;
64
output [31:0] data;
65
 
66
 
67
reg ack_o;
68
reg [31:0] data;
69
 
70
reg [7:0] buff [0:65535];
71
//reg [7:0] buff [8388607:0];
72
reg [2:0] cnt;
73
integer i;
74
 
75
 
76
wire [7:0] buff_0 = buff [0];
77
wire [7:0] buff_1 = buff [1];
78
wire [7:0] buff_2 = buff [2];
79
wire [7:0] buff_3 = buff [3];
80
 
81
initial
82
begin
83
//  for (i=0; i<65536; i=i+1)
84
//    buff [i] = 8'h00;
85
  $readmemh("./dat/oc8051_xrom.in", buff);
86
  for (i=0; i<10; i=i+1)
87
    $display("i : %h",buff [i] );
88
end
89
 
90
always @(posedge clk or posedge rst)
91
begin
92
  if (rst) begin
93
    data <= #1 31'h0;
94
    ack_o <= #1 1'b0;
95
  end else if (stb_i && ((DELAY==3'b000) || (cnt==3'b000))) begin
96
    data <= #1 {buff[addr+3], buff[addr+2], buff[addr+1], buff [addr]};
97
    ack_o <= #1 1'b1;
98
  end else
99
    ack_o <= #1 1'b0;
100
end
101
 
102
always @(posedge clk or posedge rst)
103
begin
104
  if (rst)
105
    cnt <= #1 DELAY;
106
  else if (cnt == 3'b000)
107
    cnt <= #1 DELAY;
108
  else if (stb_i)
109
    cnt <= #1 cnt - 3'b001;
110
  else cnt <= #1 DELAY;
111
end
112
 
113
endmodule
114
 
115
 

powered by: WebSVN 2.1.0

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