Hi Vipin, The solution will depend on the way you want to retrieve your saved messages.
If you want to retrieve them in the same order you saved them, just add an extra MessageBuffer to the cache machine, initialize it in the python script and enqueue/dequeue in it the messages you want to save (hint, if using gem5 v21+, you should be able to write out_msg := in_msg instead of copying all fields by hand). If you do not store too many messages, you can also attempt to use the recycle feature of MessageBuffer to cycle through messages and find the one you are looking for. Because ruby does not support loops, you will have to hack the built_in controller wake up loop. Details would be a bit too long to expose and I don't have time to test my idea... But that will definitely make for a fun exercise ;) You can also store inside the TBE all the information you need to reconstruct the message when needed. Last approach that should work for associative lookup: define your own container similar to TBE but with support for non default constructible types. This will be hacky but sometime ruby does not leave you the choice. Here is a very simple example that you can adapt to your need: 1. Put "#include <unordered_map>" in a new file "src/mem/ruby/protocol/std::unordered_map.hh" (do not forget the std:: in the file name as ruby will automatiaclly include this exact file because of 2.) 2. Add structure(std::unordered_map, external="yes") { void emplace(Addr, MyMsgType); MyMsgType at(Addr); void erase(Addr); } std::unordered_map myMapName, template="<Addr, MyMsgType>"; to your machine. 3. You can now write myMapName.emplace(addr, in_msg); out_msg := myMapName.at(addr); myMapName.erase(addr); This is very hacky and I don't recommend this for anything other than internal use, but it should work like a charm. If you need something cleaner, you will have to dive into ruby code generation and how it interfaces with C++. You will then be able to define arbitrary complex C++ constructs that can be used from inside ruby. And if I am missing a more idiomatic solution, anyone please enlighten me ;) Best, Gabriel _______________________________________________ gem5-users mailing list -- gem5-users@gem5.org To unsubscribe send an email to gem5-users-le...@gem5.org %(web_page_url)slistinfo%(cgiext)s/%(_internal_name)s