Deleted Added
sdiff udiff text old ( 6844:b8421af116e5 ) new ( 6876:a658c315512c )
full compact
1#ifndef RUBYPORT_H
2#define RUBYPORT_H
3
4#include "mem/ruby/libruby.hh"
5#include <string>
6#include <assert.h>
7
8using namespace std;
9
10class RubyPort {
11public:
12 RubyPort(const string & name)
13 : m_name(name)
14 {
15 m_port_id = m_num_ports++;
16 m_request_cnt = 0;
17 m_hit_callback = NULL;
18 assert(m_num_ports <= 2048); // see below for reason
19 }
20 virtual ~RubyPort() {}
21
22 virtual int64_t makeRequest(const RubyRequest & request) = 0;
23
24 void registerHitCallback(void (*hit_callback)(int64_t request_id)) {
25 assert(m_hit_callback == NULL); // can't assign hit_callback twice
26 m_hit_callback = hit_callback;
27 }
28
29protected:

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

46 // and 2^48 ~= 3x10^14 requests per component
47
48 int64_t id = (static_cast<uint64_t>(m_port_id) << 48) | m_request_cnt;
49 m_request_cnt++;
50 // assert((m_request_cnt & (1<<48)) == 0);
51 return id;
52 }
53
54private:
55 static uint16_t m_num_ports;
56 uint16_t m_port_id;
57 uint64_t m_request_cnt;
58};
59
60#endif