simulavr  1.1.0
hwsreg.h
Go to the documentation of this file.
1  /*
2  ****************************************************************************
3  *
4  * simulavr - A simulator for the Atmel AVR family of microcontrollers.
5  * Copyright (C) 2001, 2002, 2003 Klaus Rudolph
6  *
7  * This program is free software; you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation; either version 2 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License along
18  * with this program; if not, write to the Free Software Foundation, Inc.,
19  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
20  *
21  ****************************************************************************
22  *
23  * $Id$
24  */
25 
26 #ifndef HWSREG
27 #define HWSREG
28 #include <string>
29 
30 #include "rwmem.h"
31 #include "traceval.h"
32 
33 /* this is the fastes solution, tested on Ubuntu and WinXP */
34 class HWSreg_bool {
35 
36  public:
37  bool I;
38  bool T;
39  bool H;
40  bool S;
41  bool V;
42  bool N;
43  bool Z;
44  bool C;
45 #ifndef SWIG
46  operator int();
47 #endif
48  HWSreg_bool(const int i);
49  HWSreg_bool();
50 };
51 
52 class HWSreg: public HWSreg_bool {
53 
54  public:
55 #ifndef SWIG
56  operator std::string();
57  HWSreg operator =(const int );
58 #endif
59 };
60 
65 class RWSreg: public RWMemoryMember {
66 
67  public:
68  RWSreg(TraceValueRegister *registry, HWSreg *s): RWMemoryMember(registry, "SREG"), status(s) {}
70  void trigger_change(void) { tv->change((int)*status); }
71 
72  protected:
74  unsigned char get() const;
75  void set(unsigned char);
76 };
77 
78 #endif
bool V
Definition: hwsreg.h:41
HWSreg * status
Definition: hwsreg.h:73
HWSreg_bool()
Definition: hwsreg.cpp:46
bool S
Definition: hwsreg.h:40
RWSreg(TraceValueRegister *registry, HWSreg *s)
Definition: hwsreg.h:68
Definition: hwsreg.h:52
Definition: hwsreg.h:65
Build a register for TraceValue&#39;s.
Definition: traceval.h:442
bool C
Definition: hwsreg.h:44
void trigger_change(void)
reflect a change, which comes from CPU core
Definition: hwsreg.h:70
Member of any memory area in an AVR device.
Definition: rwmem.h:42
bool Z
Definition: hwsreg.h:43
bool I
Definition: hwsreg.h:37
bool H
Definition: hwsreg.h:39
bool T
Definition: hwsreg.h:38
bool N
Definition: hwsreg.h:42