SubBlock.hh (11040:ec668f8466eb) SubBlock.hh (11049:dfb0aa3f0649)
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 42 unchanged lines hidden (view full) ---

51 void setByte(int offset, uint8_t data) { m_data[offset] = data; }
52
53 // Shorthands
54 uint8_t readByte() const { return getByte(0); }
55 void writeByte(uint8_t data) { setByte(0, data); }
56
57 // Merging to and from DataBlocks - We only need to worry about
58 // updates when we are using DataBlocks
1/*
2 * Copyright (c) 1999-2008 Mark D. Hill and David A. Wood
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are
7 * met: redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer;

--- 42 unchanged lines hidden (view full) ---

51 void setByte(int offset, uint8_t data) { m_data[offset] = data; }
52
53 // Shorthands
54 uint8_t readByte() const { return getByte(0); }
55 void writeByte(uint8_t data) { setByte(0, data); }
56
57 // Merging to and from DataBlocks - We only need to worry about
58 // updates when we are using DataBlocks
59 void mergeTo(DataBlock& data) const;
60 void mergeFrom(const DataBlock& data);
59 void mergeTo(DataBlock& data) const { internalMergeTo(data); }
60 void mergeFrom(const DataBlock& data) { internalMergeFrom(data); }
61
62 void print(std::ostream& out) const;
63
64 private:
61
62 void print(std::ostream& out) const;
63
64 private:
65 void internalMergeTo(DataBlock& data) const;
66 void internalMergeFrom(const DataBlock& data);
67
65 // Data Members (m_ prefix)
66 Addr m_address;
67 std::vector<uint8_t> m_data;
68};
69
70inline std::ostream&
71operator<<(std::ostream& out, const SubBlock& obj)
72{
73 obj.print(out);
74 out << std::flush;
75 return out;
76}
77
78#endif // __MEM_RUBY_COMMON_SUBBLOCK_HH__
68 // Data Members (m_ prefix)
69 Addr m_address;
70 std::vector<uint8_t> m_data;
71};
72
73inline std::ostream&
74operator<<(std::ostream& out, const SubBlock& obj)
75{
76 obj.print(out);
77 out << std::flush;
78 return out;
79}
80
81#endif // __MEM_RUBY_COMMON_SUBBLOCK_HH__