Closed Nava2 closed 7 years ago
I like the changes you made to the form and layout of the dialogs. They look great.
Here are some errors I found when I first tried to use the code in the PR. Am I doing something wrong that is causing all these errors or do you get them too?
[x] I can't load old .cpu files. In particular, the Wombat1.cpu that is included as a sample machine with the CPU Sim distribution cannot be loaded.
[x] I created a new empty machine by starting CPU Sim and immediately tried saving the current new machine, but it threw an exception.
[x] I tried a lot of the menu items with a new empty machine, but encountered the following problems:
MachineInstruction
throws an exception for some reason...[x] Need to add proper converters for the TableViewColumn
to show the name
, not the toString()
for almost all components.. probably just need a ColumnForNamedObjectConvertor
or something
That's enough for starters.
I made everything checkboxes.
I apologize, I thought I tested it better than that! I think I was micro-testing over macro, I'll be working on these tomorrow.
Most of the loading of machines was blind refactoring that I forgot to test and update, working on that now. The others will require some more debugging, I'm adding the two CPUs to the test resources and writing some unit tests to check this behaviour. No need to have to retest by hand later! 😨
I've been working on fixing the reader and am adding some "legacy switches" so we can change it later without breaking previous reads (it'd write in the newer format hopefully). Few things:
test1.cpu
and Wombat2.cpu
in the repository, is one newer than the other?source1
as lhs
and source2
as rhs
, the two you sent me via email use sourceX
and the two in the repo use lhs
/rhs
. I think sourceX
makes more sense, but which one would you consider "correct" for legacy?JVM2.cpu
file has no fields for the contents, it just says <FieldLength length="8" />
for example, I feel like this file may be older than the most recent version. If I had to wager, I think the Wombat1.cpu
you sent me is the "correct" of the group as it is the one shipped with the v4.0.9 download and is identical (minus some line endings 😄) to the one you sent me.
You said "Arithmetic operations have two names for source1 as lhs and source2 as rhs, the two you sent me via email use sourceX and the two in the repo use lhs/rhs. I think sourceX makes more sense, but which one would you consider 'correct' for legacy?" I couldn't find "lhs" or "rhs" in the test1.cpu and Wombat2.cpu in the repo. They contain sourceX like the ones I sent you. "source1" and "source2" are the only correct names for the attributes.
There are a few backwards compatibility issues that the MachineReader needs to deal with but the main one concerns the fields. See the MachineReader's startMachineInstruction() and endMachineInstruction() methods for details.
I couldn't find "lhs" or "rhs" in the test1.cpu and Wombat2.cpu in the repo. They contain sourceX like the ones I sent you. "source1" and "source2" are the only correct names for the attributes.
Maybe it was lost in translation, I'll go searching some more!
There are a few backwards compatibility issues that the MachineReader needs to deal with but the main one concerns the fields. See the MachineReader's startMachineInstruction() and endMachineInstruction() methods for details.
The Field
tag works okay, it seems that the JVM2.cpu
doesn't define any fields.
From Wombat1.cpu
:
<!--......... machine instruction fields ............-->
<Field name="addr" type="required" numBits="12" relativity="absolute" signed="false" defaultValue="0" id="model.Field14ee11fc">
</Field>
<Field name="unused" type="ignored" numBits="12" relativity="absolute" signed="true" defaultValue="0" id="model.Field7e3f8810">
</Field>
<Field name="op" type="required" numBits="4" relativity="absolute" signed="false" defaultValue="0" id="model.Field246a65ca">
</Field>
In JVM2.cpu
there are no <Field>
tags, just <FieldLength>
and none are referenced. Could the file be older than you thought? I found some commented material in the MachineReader
regarding an old and now non-existent FieldLength
element.
In the repository I found: these. I have the Wombat1.cpu
working fully (I think!) and the test1.cpu
almost works, I need to fix a bug I introduced in Comparable
usage in List properties (I had no idea it was used...).
On Jan 25, 2017, at 6:06 PM, Kevin Brightwell notifications@github.com wrote:
The Field tag works okay, it seems that the JVM2.cpu doesn't define any fields. ... In JVM2.cpu there are no
tags, just and none are referenced. Could the file be older than you thought? I found some commented material in the MachineReader regarding an old and now non-existent FieldLength element.
The JVM2.cpu file is properly loaded, as I said, by CPU Sim 4.0.9. The MachineReader accesses the FieldLengths using the startFieldLength() method. As it reads more and more field lengths, it builds the format for the instruction by appending the lengths in a string. Then, in the endMachineInstruction() method, the format string is used to construct the desired fields and add them to the machine instruction.
In the repository I found: these. I have the Wombat1.cpu working fully (I think!) and the test1.cpu almost works, I need to fix a bug I introduced in Comparable usage in List properties (I had no idea it was used…).
Yes, those are the only two .cpu files in the test resources right now. I have several more .cpu files to use to test reading and writing. I’ll add them to the repository.
Dale
The JVM2.cpu file is properly loaded, as I said, by CPU Sim 4.0.9. The MachineReader accesses the FieldLengths using the startFieldLength() method. As it reads more and more field lengths, it builds the format for the instruction by appending the lengths in a string. Then, in the endMachineInstruction() method, the format string is used to construct the desired fields and add them to the machine instruction.
I'll check that, I didn't think to even look how it was being loaded. I'll work on getting that working. Progress has been made though.
I do want to replace the DTD with an XSD to allow for varying order of elements, the current DTD doesn't let the order change which is an unnecessary change.
Thanks for clarifying this stuff! 👍
@djskrien I now have them all loading and working, from what I can tell. Everything seems to be loading. Some aesthetics are needed to be fixed, but yeah. I'll start working on the rest of the list.
Almost done with these bugs I think. Sorry I've been slow with this, some of them were harder than others, and teaching has eaten a lot of my time.
I fixed all of the errors that have been found. I'm terribly sorry it took so long!
This is what is shown on the empty assembly now:
I've closed this as we are doing large changes over the summer. There are many things we are doing to get peripherals added to the model and expose them.
Firstly, I am horribly sorry that this took so long to get opened to begin with. Turns out, teaching a course is a lot of work the first time.
Changes
cpusim.model/
, there's also acpusim.test.harness
project that just has testing code<Object>
calls with<T>
whereT
was the applicable typeString
IDs withUUID
, including an attempt to backport to loading old modelsBefore Merging
I have been trying to test this as I go, there will be bugs. I really need help in testing this to make sure I didn't break things (I have inevitably done so, I'm sure).
Next Steps
We need more tests, I am so terrified about these changes because I can't just run
gradle test
and check the changes, but I've added tests when I had time. Going forward, the project needs more unit tests so that things can be verified as working to what the expected cases are.