-
-
Notifications
You must be signed in to change notification settings - Fork 278
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
External io tcp support #169
base: master
Are you sure you want to change the base?
Conversation
I think since it seems like we're going to go with a non-Qt solution for the tcp client, i think it would be good to have proper tests of the solution so we can verify it on all platforms. I imagine a new |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As i wrote above, i think having unit tests for the tcp client would be very good to ensure that this works cross-platform. A few comments on style, code cleanup and C++ norms.
@lcgamboa could you elaborate a little bit on what/where crashes are triggered? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the comments are stylistic. A general comment would be to add a few more comments across the code to explain what is going on - makes reviewing, and maintaining(!) things a lot easier.
I made all the modifications you requested. Sorry for the lack of comments in the source code, it really is my fault for not being used to working in a team. |
Thanks! don't worry too much about it, it's just another benefit of doing collaborative open source work that the people involved gain experience in giving, getting, and acting on feedback!
I will try this out once i have the chance 👍. I would also recommend rebasing your branch to master since there was a bit of a nasty bug in the InstructionMatcher which caused some issues. |
Yes I have learned a lot working on Ripes. |
daad80f
to
09b8475
Compare
You're right - should be done now 👍 . |
1d5d11b
to
6e48ef1
Compare
6e48ef1
to
db91e99
Compare
Would you mind doing a rebase onto the current master branch? I think you've merged the master branch into this branch. By doing this, all changes in the master branch is also seen as changes in this PR, making it hard to review the code (i cannot discern your contributions from the additions in the master branch). |
src/io/ioexternalbus.cpp
Outdated
QJsonObject osymbols = desc.object().value(QString("symbols")).toObject(); | ||
|
||
m_regDescs.clear(); | ||
for (QJsonObject::iterator i = osymbols.begin(); i != osymbols.end(); i++) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does range notation not work for a QJsonObject
?
for(auto& it : osymbols) ...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I couldn't use it and I didn't find any example that uses it.
The range notation (using const auto&) returns an object of type QJsonValueRef which I was unable to convert to use.
7c2c6b9
to
6983ca2
Compare
I added support for passing simulation time to PICSimLab to synchronize simulators. Is there an easy way to be able to use the instruction counter value instead of the constants I added for testing? |
@lcgamboa the processor interface contains a hook to get the current cycle count, which can be used through the processor handler. |
@mortbopet I ended up using the wall time instead of the instructions counter, it got better result since Ripes doesn't use a fixed simulation frequency. I followed your guidance and tried to use QTcpSocket instead of the XTcpSocket class I created. But I keep having deadlock problems because of Qt's sockets implementation and the ioRead and ioWrite implementation in Ripes. As it is necessary to send a command via TCP and wait for the response within the ioRead and ioWrite methods, the only possible way I found to wait is to use a QEventLoop. If you want to take a look at the code using QTcpSocket it's in this branch https://github.com/lcgamboa/Ripes/blob/QTtcpSocket/src/io/ioexternalbus.cpp . |
Could you explain this a bit more? I'm assuming that the control flow of a simulation is:
Where does the deadlock come into play? where are the multiple threads coming from/doing, which tries to access the bus concurrently? |
Apparently the problem is between step 4 and 5, the Ripes simulation is not always stalled. Running step by step everything works, several threads access the ioRead and ioWrite methods.
In animation mode apparently the main thread tries to use ioWrite before the pooled thread finishes ioRead:
In fast simulation mode, when the pause is triggered apparently the main thread tries to access the ioRead several times.
To wait for the Socket's response, it is necessary to use a local QEventLoop to process the signals and events, I believe that this is why the simulation does not stalled. |
Initial release of IPC support. I only tested on Linux. After unraveling the obscure MSVC compiler error messages the code compiles in github actions. But I don't have MSVC available to test here.
The server for testing is on another branch, I don't think it's interesting to add it to the main Ripes version.