8 typedef void* RubyPortHandle;
11 RubyRequestType_IFETCH,
14 RubyRequestType_Locked_Read,
15 RubyRequestType_Locked_Write,
16 RubyRequestType_RMW_Read,
17 RubyRequestType_RMW_Write,
23 RubyAccessMode_Supervisor,
33 RubyAccessMode access_mode;
37 RubyRequest(uint64_t _paddr, uint8_t* _data, int _len, uint64_t _pc, RubyRequestType _type, RubyAccessMode _access_mode, unsigned _proc_id = 100)
38 : paddr(_paddr), data(_data), len(_len), pc(_pc), type(_type), access_mode(_access_mode), proc_id(_proc_id)
42 std::ostream& operator<<(std::ostream& out, const RubyRequest& obj);
45 * Initialize the system. cfg_file is a Ruby-lang configuration script
47 void libruby_init(const char* cfg_file);
50 * Tear down a configured system. Must be invoked after a call to libruby_init.
52 void libruby_destroy();
55 * Print the last error encountered by ruby. Currently unimplemented.
57 const char* libruby_last_error();
60 * Retrieve a handle to a RubyPort object, identified by name in the
61 * configuration. You also pass in the callback function you want
62 * this port to use when a request completes. Only one handle to a
63 * port is allowed at a time.
65 RubyPortHandle libruby_get_port(const char* name, void (*hit_callback)(int64_t access_id));
68 * Retrieve a handle to a RubyPort object, identified by name in the
71 RubyPortHandle libruby_get_port_by_name(const char* name);
75 * libruby_issue_request error return codes
77 #define LIBRUBY_BUFFER_FULL -2
78 #define LIBRUBY_ALIASED_REQUEST -3
81 * issue_request returns a unique access_id to identify the ruby
82 * transaction. This access_id is later returned to the caller via
83 * hit_callback (passed to libruby_get_port)
85 int64_t libruby_issue_request(RubyPortHandle p, struct RubyRequest request);
88 * writes data directly into Ruby's data array. Note that this
89 * ignores caches, and should be considered incoherent after
92 void libruby_write_ram(uint64_t paddr, uint8_t * data, int len);
95 * reads data directory from Ruby's data array. Note that this
96 * ignores caches, and should be considered incoherent after
99 void libruby_read_ram(uint64_t paddr, uint8_t * data, int len);
102 * tick the system n cycles. Eventually, will return the number of
103 * cycles until the next event, but for now it always returns 0
105 int libruby_tick(int n);
110 void libruby_print_config(std::ostream & out);
115 void libruby_print_stats(std::ostream & out);
118 * does not return until done
120 void libruby_playback_trace(char * trace_filename);
123 * enables the tracer and opens the trace file
125 void libruby_start_tracing(char * record_filename);
128 * closes the trace file
130 void libruby_stop_tracing();
135 uint64_t libruby_get_time();