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

Subversion Repositories oms8051mini

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

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

powered by: WebSVN 2.1.0

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