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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [rtl/] [8051/] [oc8051_indi_addr.v] - Blame information for rev 53

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

Line No. Rev Author Line
1 2 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 indirect address                                       ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/8051/                        ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   Contains ragister 0 and register 1. used for indirrect     ////
10
////   addressing.                                                ////
11
////                                                              ////
12
////  To Do:                                                      ////
13
////   nothing                                                    ////
14
////                                                              ////
15
////  Author(s):                                                  ////
16
////      - Simon Teran, simont@opencores.org                     ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19
////                                                              ////
20
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
21
////                                                              ////
22
//// This source file may be used and distributed without         ////
23
//// restriction provided that this copyright statement is not    ////
24
//// removed from the file and that any derivative work contains  ////
25
//// the original copyright notice and the associated disclaimer. ////
26
////                                                              ////
27
//// This source file is free software; you can redistribute it   ////
28
//// and/or modify it under the terms of the GNU Lesser General   ////
29
//// Public License as published by the Free Software Foundation; ////
30
//// either version 2.1 of the License, or (at your option) any   ////
31
//// later version.                                               ////
32
////                                                              ////
33
//// This source is distributed in the hope that it will be       ////
34
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
35
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
36
//// PURPOSE.  See the GNU Lesser General Public License for more ////
37
//// details.                                                     ////
38
////                                                              ////
39
//// You should have received a copy of the GNU Lesser General    ////
40
//// Public License along with this source; if not, download it   ////
41
//// from http://www.opencores.org/lgpl.shtml                     ////
42
////                                                              ////
43
//////////////////////////////////////////////////////////////////////
44
//
45
// CVS Revision History
46
//
47
// $Log: not supported by cvs2svn $
48
// Revision 1.6  2003/05/05 15:46:37  simont
49
// add aditional alu destination to solve critical path.
50
//
51
// Revision 1.5  2003/01/13 14:14:41  simont
52
// replace some modules
53
//
54
// Revision 1.4  2002/09/30 17:33:59  simont
55
// prepared header
56
//
57
//
58
 
59
// synopsys translate_off
60
`include "oc8051_timescale.v"
61
// synopsys translate_on
62
 
63
 
64
module oc8051_indi_addr (clk, rst, wr_addr, data_in, wr, wr_bit, ri_out, sel, bank);
65
//
66
 
67
 
68
input        clk,       // clock
69
             rst,       // reset
70
             wr,        // write
71
             sel,       // select register
72
             wr_bit;    // write bit addressable
73
input  [1:0] bank;       // select register bank
74
input  [7:0] data_in;    // data input
75
input  [7:0] wr_addr;    // write address
76
 
77
output [7:0] ri_out;
78
 
79
//reg [7:0] buff [31:0];
80
reg wr_bit_r;
81
 
82
 
83
reg [7:0] buff [0:7];
84
 
85
//
86
//write to buffer
87
always @(posedge clk or posedge rst)
88
begin
89
  if (rst) begin
90
    buff[3'b000] <= #1 8'h00;
91
    buff[3'b001] <= #1 8'h00;
92
    buff[3'b010] <= #1 8'h00;
93
    buff[3'b011] <= #1 8'h00;
94
    buff[3'b100] <= #1 8'h00;
95
    buff[3'b101] <= #1 8'h00;
96
    buff[3'b110] <= #1 8'h00;
97
    buff[3'b111] <= #1 8'h00;
98
  end else begin
99
    if ((wr) & !(wr_bit_r)) begin
100
      case (wr_addr) /* synopsys full_case parallel_case */
101
        8'h00: buff[3'b000] <= #1 data_in;
102
        8'h01: buff[3'b001] <= #1 data_in;
103
        8'h08: buff[3'b010] <= #1 data_in;
104
        8'h09: buff[3'b011] <= #1 data_in;
105
        8'h10: buff[3'b100] <= #1 data_in;
106
        8'h11: buff[3'b101] <= #1 data_in;
107
        8'h18: buff[3'b110] <= #1 data_in;
108
        8'h19: buff[3'b111] <= #1 data_in;
109
      endcase
110
    end
111
  end
112
end
113
 
114
//
115
//read from buffer
116
 
117
assign ri_out = (({3'b000, bank, 2'b00, sel}==wr_addr) & (wr) & !wr_bit_r) ?
118
                 data_in : buff[{bank, sel}];
119
 
120
 
121
 
122
always @(posedge clk or posedge rst)
123
  if (rst) begin
124
    wr_bit_r <= #1 1'b0;
125
  end else begin
126
    wr_bit_r <= #1 wr_bit;
127
  end
128
 
129
endmodule

powered by: WebSVN 2.1.0

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