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

Subversion Repositories turbo8051

[/] [turbo8051/] [trunk/] [rtl/] [8051/] [oc8051_dptr.v] - Blame information for rev 76

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 76 dinesha
//// http://www.opencores.org/cores/turb08051/                    ////
7 2 dinesha
////                                                              ////
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 76 dinesha
////      - Dinesh Annayya, dinesha@opencores.org                 ////
17 2 dinesha
////                                                              ////
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.3  2003/01/13 14:14:40  simont
49
// replace some modules
50
//
51
// Revision 1.2  2002/09/30 17:33:59  simont
52
// prepared header
53
//
54
//
55
 
56
 
57 76 dinesha
`include "top_defines.v"
58 2 dinesha
 
59
 
60
module oc8051_dptr(clk, rst, addr, data_in, data2_in, wr, wr_sfr, wr_bit, data_hi, data_lo);
61
//
62
// clk          (in)  clock
63
// rst          (in)  reset
64
// addr         (in)  write address input [oc8051_ram_wr_sel.out]
65
// data_in      (in)  destination 1 from alu [oc8051_alu.des1]
66
// data2_in     (in)  destination 2 from alu [oc8051_alu.des2]
67
// wr           (in)  write to ram [oc8051_decoder.wr -r]
68
// wd2          (in)  write from destination 2 [oc8051_decoder.ram_wr_sel -r]
69
// wr_bit       (in)  write bit addresable [oc8051_decoder.bit_addr -r]
70
// data_hi      (out) output (high bits) [oc8051_alu_src3_sel.dptr, oc8051_ext_addr_sel.dptr_hi, oc8051_ram_sel.dptr_hi]
71
// data_lo      (out) output (low bits) [oc8051_ext_addr_sel.dptr_lo]
72
//
73
 
74
 
75
input clk, rst, wr, wr_bit;
76
input [1:0] wr_sfr;
77
input [7:0] addr, data_in, data2_in;
78
 
79
output [7:0] data_hi, data_lo;
80
 
81
reg [7:0] data_hi, data_lo;
82
 
83
always @(posedge clk or posedge rst)
84
begin
85
  if (rst) begin
86
    data_hi <= #1 `OC8051_RST_DPH;
87
    data_lo <= #1 `OC8051_RST_DPL;
88
  end else if (wr_sfr==`OC8051_WRS_DPTR) begin
89
//
90
//write from destination 2 and 1
91
    data_hi <= #1 data2_in;
92
    data_lo <= #1 data_in;
93
  end else if ((addr==`OC8051_SFR_DPTR_HI) & (wr) & !(wr_bit))
94
//
95
//case of writing to dptr
96
    data_hi <= #1 data_in;
97
  else if ((addr==`OC8051_SFR_DPTR_LO) & (wr) & !(wr_bit))
98
    data_lo <= #1 data_in;
99
end
100
 
101
endmodule
102
 

powered by: WebSVN 2.1.0

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