Bitstream Interpretation Library (BIL)  0.1
V5IDCODERegister.cpp
Go to the documentation of this file.
1 
11 
12 using namespace bil;
13 
14 
16  Register(V5RegisterAddress::IDCODE, V5RegisterAddress::IDCODE_STRING, true, true),
17  m_idCode(),
18  m_fdriRegister(fdriReg),
19  m_addressLayoutRegistry(registry)
20 {
21 
22 }
23 
24 
25 void V5IDCODERegister::write(const boost::uint32_t* words, size_t wordCount)
26 {
27  Register::write(words, wordCount);
28 
29  // word count has to be 1
30  if (1 != wordCount) throw Exception();
31  // set command and execute
32  idCode(*words);
33 }
34 
35 
36 void V5IDCODERegister::read(boost::uint32_t* words, size_t wordCount) const
37 {
38  Register::read(words, wordCount);
39 
40  // word count has to be 1
41  if (1 != wordCount) throw Exception();
42  // return current ID code
43  *words = m_idCode;
44 }
45 
46 
48 {
49  // lookup address layout for that id
50  const V5AddressLayout* layout = m_addressLayoutRegistry.lookup(id);
51  if (0 == layout) throw Exception();
52 
53  // copy address layout to FDRI
54  V5Configuration& configuration = m_fdriRegister.configuration();
55  configuration.addressLayout(*layout);
56 
57  // store new id code
58  m_idCode = id;
59 }
60 
61 
63 {
64  return m_idCode;
65 }
66 
67 
69 {
70  return m_fdriRegister;
71 }
72 
73 
75 {
76  return m_addressLayoutRegistry;
77 }