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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_indi_addr.v] - Blame information for rev 2

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

powered by: WebSVN 2.1.0

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