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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_dptr.v] - Blame information for rev 30

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

Line No. Rev Author Line
1 2 dinesha
//////////////////////////////////////////////////////////////////////
2
////                                                              ////
3
////  8051 data pointer                                           ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/oms8051mini/                 ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   8051 special function register: data pointer               ////
10
////                                                              ////
11
////  To Do:                                                      ////
12
////   nothing                                                    ////
13
////                                                              ////
14
////  Author(s):                                                  ////
15
////      - Simon Teran, simont@opencores.org                     ////
16
////      - Dinesh Annayya, dinesha@opencores.org                 ////
17
////                                                              ////
18
//////////////////////////////////////////////////////////////////////
19 25 dinesha
////   v0.0 - Dinesh A, 5th Jan 2017
20
////        1. Active edge of reset changed from High to Low
21
//////////////////////////////////////////////////////////////////////
22 2 dinesha
////                                                              ////
23
//// Copyright (C) 2000 Authors and OPENCORES.ORG                 ////
24
////                                                              ////
25
//// This source file may be used and distributed without         ////
26
//// restriction provided that this copyright statement is not    ////
27
//// removed from the file and that any derivative work contains  ////
28
//// the original copyright notice and the associated disclaimer. ////
29
////                                                              ////
30
//// This source file is free software; you can redistribute it   ////
31
//// and/or modify it under the terms of the GNU Lesser General   ////
32
//// Public License as published by the Free Software Foundation; ////
33
//// either version 2.1 of the License, or (at your option) any   ////
34
//// later version.                                               ////
35
////                                                              ////
36
//// This source is distributed in the hope that it will be       ////
37
//// useful, but WITHOUT ANY WARRANTY; without even the implied   ////
38
//// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR      ////
39
//// PURPOSE.  See the GNU Lesser General Public License for more ////
40
//// details.                                                     ////
41
////                                                              ////
42
//// You should have received a copy of the GNU Lesser General    ////
43
//// Public License along with this source; if not, download it   ////
44
//// from http://www.opencores.org/lgpl.shtml                     ////
45
////                                                              ////
46
//////////////////////////////////////////////////////////////////////
47
//
48
// CVS Revision History
49
//
50
// $Log: not supported by cvs2svn $
51
// Revision 1.3  2003/01/13 14:14:40  simont
52
// replace some modules
53
//
54
// Revision 1.2  2002/09/30 17:33:59  simont
55
// prepared header
56
//
57
//
58
 
59
 
60
`include "top_defines.v"
61
 
62
 
63 25 dinesha
module oc8051_dptr(clk, resetn, addr, data_in, data2_in, wr, wr_sfr, wr_bit, data_hi, data_lo);
64 2 dinesha
//
65
// clk          (in)  clock
66 25 dinesha
// resetn          (in)  reset
67 2 dinesha
// addr         (in)  write address input [oc8051_ram_wr_sel.out]
68
// data_in      (in)  destination 1 from alu [oc8051_alu.des1]
69
// data2_in     (in)  destination 2 from alu [oc8051_alu.des2]
70
// wr           (in)  write to ram [oc8051_decoder.wr -r]
71
// wd2          (in)  write from destination 2 [oc8051_decoder.ram_wr_sel -r]
72
// wr_bit       (in)  write bit addresable [oc8051_decoder.bit_addr -r]
73
// data_hi      (out) output (high bits) [oc8051_alu_src3_sel.dptr, oc8051_ext_addr_sel.dptr_hi, oc8051_ram_sel.dptr_hi]
74
// data_lo      (out) output (low bits) [oc8051_ext_addr_sel.dptr_lo]
75
//
76
 
77
 
78 25 dinesha
input clk, resetn, wr, wr_bit;
79 2 dinesha
input [1:0] wr_sfr;
80
input [7:0] addr, data_in, data2_in;
81
 
82
output [7:0] data_hi, data_lo;
83
 
84
reg [7:0] data_hi, data_lo;
85
 
86 25 dinesha
always @(posedge clk or negedge resetn)
87 2 dinesha
begin
88 25 dinesha
  if (resetn == 1'b0) begin
89 2 dinesha
    data_hi <= #1 `OC8051_RST_DPH;
90
    data_lo <= #1 `OC8051_RST_DPL;
91
  end else if (wr_sfr==`OC8051_WRS_DPTR) begin
92
//
93
//write from destination 2 and 1
94
    data_hi <= #1 data2_in;
95
    data_lo <= #1 data_in;
96
  end else if ((addr==`OC8051_SFR_DPTR_HI) & (wr) & !(wr_bit))
97
//
98
//case of writing to dptr
99
    data_hi <= #1 data_in;
100
  else if ((addr==`OC8051_SFR_DPTR_LO) & (wr) & !(wr_bit))
101
    data_lo <= #1 data_in;
102
end
103
 
104
endmodule
105
 

powered by: WebSVN 2.1.0

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