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

Subversion Repositories oms8051mini

[/] [oms8051mini/] [trunk/] [rtl/] [8051/] [oc8051_b_register.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 cores b register                                       ////
4
////                                                              ////
5
////  This file is part of the 8051 cores project                 ////
6
////  http://www.opencores.org/cores/oms8051mini/                 ////
7
////                                                              ////
8
////  Description                                                 ////
9
////   b register for 8051 core                                   ////
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
////                                                              ////
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.8  2003/04/07 14:58:02  simont
49
// change sfr's interface.
50
//
51
// Revision 1.7  2003/01/13 14:14:40  simont
52
// replace some modules
53
//
54
// Revision 1.6  2002/09/30 17:33:59  simont
55
// prepared header
56
//
57
//
58
 
59
`include "top_defines.v"
60
 
61
 
62
module oc8051_b_register (clk, rst, bit_in, data_in, wr, wr_bit,
63
              wr_addr, data_out);
64
 
65
 
66
input clk, rst, wr, wr_bit, bit_in;
67
input [7:0] wr_addr, data_in;
68
 
69
output [7:0] data_out;
70
 
71
reg [7:0] data_out;
72
 
73
//
74
//writing to b
75
//must check if write high and correct address
76
always @(posedge clk or posedge rst)
77
begin
78
  if (rst)
79
    data_out <= #1 `OC8051_RST_B;
80
  else if (wr) begin
81
    if (!wr_bit) begin
82
      if (wr_addr==`OC8051_SFR_B)
83
        data_out <= #1 data_in;
84
    end else begin
85
      if (wr_addr[7:3]==`OC8051_SFR_B_B)
86
        data_out[wr_addr[2:0]] <= #1 bit_in;
87
    end
88
  end
89
end
90
 
91
endmodule

powered by: WebSVN 2.1.0

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