-
Notifications
You must be signed in to change notification settings - Fork 62
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
XCVR code cleanup #118
XCVR code cleanup #118
Conversation
Add matching TRANSCEIVER_IO_SET(vTR_DBP,TR_INPUT) to writeDataPhase() and writeDataPhaseSD()
Tested, and the results are mixed. |
Code which sets the data bit transceivers back to input is unnecessary, unless there's a later phase where the initiator needs to send data/messages to the target. At the beginning of the loop() there's a block which sets transceivers back to input. |
It occurred to me I can actually run this code on a regular BlueSCSI, the transceiver control lines just don't do anything. I had a look at what is going on, and there are two performance issues.
The other thing that occurred to me: I think leaving TRANSCEIVER_IO_SET(vTR_DBP,TR_OUTPUT) until the writeDataLoop() function is actually temporarily leaving the SMT32F103 and the transceiver chips both driving the GPIO lines at the same time? |
I had a look, and we can actually remove SCSI_DB_INPUT() in the same places for the same reason, so I have done that. |
Benchmark of the latest change results in 1253/1350 |
I've somewhat narrowed down an alignment issue being something linked in to the binary after the loop() function, which means it is a coin toss as to if there is a slight performance impact depending on the size of the code up to and including the loop() function. I've done a quick temporary fix by adding a 4 byte nop in the XCVR code path. Here is what I am seeing performance wise: XCVR without any of this change: XCVR with the latest change: |
@@ -920,9 +920,6 @@ void writeDataLoop(uint32_t blocksize, const byte* srcptr) | |||
// Start the first bus cycle. | |||
FETCH_BSRR_DB(); | |||
REQ_OFF_DB_SET(bsrr_val); | |||
#ifdef XCVR | |||
TRANSCEIVER_IO_SET(vTR_DBP,TR_OUTPUT) |
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.
Restoring this segment increases read speed to 1335/1383 on beige G3 (three benchmarks run on two different disk images, this is the average of results).
Despite making the code appear less efficient, speeds are increased with this segment.
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.
It will only be faster on SCSI-2 Macs (Quadras and later). If you take a look at the numbers I saw, the LC III+ read speed dropped from 1247 to 1137, about a 9% performance hit, so that alignment change is not a clear win. I've been deliberately tuning the performance to try and get good speeds across the board, rather than favoring any particular computers.
Latest benchmark here on XCVR shows 1286 read and 1375 write on G3. See my code-comment about restoring the segment inside writeDataLoop |
I noticed the XCVR changes had TRANSCEIVER_IO_SET(vTR_DBP,TR_OUTPUT) in the writeDataLoop. That results in it happening every block, rather than once per transfer, and probably messes up the code alignment potentially impacting performance.
Matching code to set the transceivers back to input also seemed to be missing. It might not actually matter, as typically commands will be followed by a status output (SCSI_DB_INPUT() might also not matter for the same reason), but that would require further investigation.
I don't have the XCVR hardware to test this change.