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

Subversion Repositories oms8051mini

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

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 25 dinesha
////   v0.0 - Dinesh A, 5th Jan 2017
21
////        1. Active edge of reset changed from High to Low
22
//////////////////////////////////////////////////////////////////////
23 2 dinesha
////                                                              ////
24
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
25
////                                                              ////
26
//// This source file may be used and distributed without         ////
27
//// restriction provided that this copyright statement is not    ////
28
//// removed from the file and that any derivative work contains  ////
29
//// the original copyright notice and the associated disclaimer. ////
30
////                                                              ////
31
//// This source file is free software; you can redistribute it   ////
32
//// and/or modify it under the terms of the GNU Lesser General   ////
33
//// Public License as published by the Free Software Foundation; ////
34
//// either version 2.1 of the License, or (at your option) any   ////
35
//// later version.                                               ////
36
////                                                              ////
37
//// This source is distributed in the hope that it will be       ////
38
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
39
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
40
//// PURPOSE.  See the GNU Lesser General Public License for more ////
41
//// details.                                                     ////
42
////                                                              ////
43
//// You should have received a copy of the GNU Lesser General    ////
44
//// Public License along with this source; if not, download it   ////
45
//// from http://www.opencores.org/lgpl.shtml                     ////
46
////                                                              ////
47
//////////////////////////////////////////////////////////////////////
48
//
49
// CVS Revision History
50
//
51
// $Log: not supported by cvs2svn $
52
// Revision 1.6  2003/05/05 15:46:37  simont
53
// add aditional alu destination to solve critical path.
54
//
55
// Revision 1.5  2003/01/13 14:14:41  simont
56
// replace some modules
57
//
58
// Revision 1.4  2002/09/30 17:33:59  simont
59
// prepared header
60
//
61
//
62
 
63
 
64 25 dinesha
module oc8051_indi_addr (clk, resetn, wr_addr, data_in, wr, wr_bit, ri_out, sel, bank);
65 2 dinesha
//
66
 
67
 
68
input        clk,       // clock
69 25 dinesha
             resetn,    // reset
70 2 dinesha
             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 25 dinesha
always @(posedge clk or negedge resetn)
88 2 dinesha
begin
89 25 dinesha
  if (resetn == 1'b0) begin
90 2 dinesha
    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 25 dinesha
always @(posedge clk or negedge resetn)
123
  if (resetn == 1'b0) begin
124 2 dinesha
    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.