Bitstream Interpretation Library (BIL)  0.1
WordRegister.cpp
Go to the documentation of this file.
1 
8 
9 using namespace bil;
10 
11 
12 WordRegister::WordRegister(RegisterAddress::address_t address, const std::string& name, bool writable, bool readable):
13  Register(address, name, writable, readable),
14  m_value(0)
15 {
16 
17 }
18 
19 
20 void WordRegister::write(const boost::uint32_t* words, size_t wordCount)
21 {
22  // call inherited
23  Register::write(words, wordCount);
24  // only one word can be written at a time
25  if (1 != wordCount) throw Exception();
26  // write word to register
27  m_value = *words;
28 }
29 
30 
31 void WordRegister::read(boost::uint32_t* words, size_t wordCount) const
32 {
33  // call inherited
34  Register::read(words, wordCount);
35  // only one word can be read at a time
36  if (1 != wordCount) throw Exception();
37  // read word from register
38  *words = m_value;
39 }
40 
41 
42 void WordRegister::value(boost::uint32_t val)
43 {
44  m_value = val;
45 }
46 
47 
48 boost::uint32_t WordRegister::value() const
49 {
50  return m_value;
51 }