StanWarford / pep9suite

Pep9Suite is a suite of software for the Pep/9 virtual machine described in the text Computer Systems, J. Stanley Warford, fifth edition.
http://computersystemsbook.com
Other
16 stars 7 forks source link

Change to pep9term "cpuasm" mode #87

Closed StanWarford closed 4 years ago

StanWarford commented 4 years ago

The CPU model does not produce or use an external object file. The assembly language level does. The asm mode produces a .pepo file, which is then input for the run mode if no assembly errors occur.

It will make scripting much easier, and more consistent with the assembly level Asmb5, If the user specifies the name of an error log text file instead of an output log file. If there are no assembly errors, then no assembly error log is created. The script can test the existence of the error log instead of the content of an output log, which is not only easier but is consistent with the behavior of the asm mode.

StanWarford commented 4 years ago

Actually, to be consistent with the asm mode, the error log file name should be autogenerated by appending "_errLog.txt" to the source file name. This is also easier to script. The user does not have to specify an error log file name.

Matthew-McRaven commented 4 years ago

That sounds reasonable to me. I can put together a solution for this relatively quickly.

Should the "cpurun" mode function similarly by dropping the output flag?

StanWarford commented 4 years ago

Yes. If you stream the output to std out, the script can simply redirect it.

Matthew-McRaven commented 4 years ago

I made these changes to Pep9Term.

No text or file is generated when there are no errors.

Otherwise, the input file is used as a base name for the error log.

For convenience of those scripting Pep9Term, I added an -e option that allows you to change the file path to the error log. This is necessary since the figures exist in a non-writable directory.

On Mon, Dec 23, 2019 at 20:15 Stan Warford notifications@github.com wrote:

Yes. If you stream the output to std out, the script can simply redirect it.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/StanWarford/pep9suite/issues/87?email_source=notifications&email_token=AIPV3AIIJD53TSC6ULW7XU3Q2GEG5A5CNFSM4J6ZUTV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHSN3HA#issuecomment-568647068, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPV3AMYWZZ3CV7HKEOENBDQ2GEG5ANCNFSM4J6ZUTVQ .

Matthew-McRaven commented 4 years ago

The "releases" tab now has a new draft version implementing the new features. Pep10Term now has these interface changes as well.

StanWarford commented 4 years ago

The program does not terminate:

Stans-iMac-Pro:collect16 warford$ pep9term cpurun --mc 01Prob1228.pepcpu -p Prob1228-Unit-1.pepcpu Program assembled successfully. Preconditions assembled successfully. Passed unit tests. ^C

I must "ctrl-c" to terminate

Matthew-McRaven commented 4 years ago

Can you email me the file?

On Sat, Dec 28, 2019 at 14:23 Stan Warford notifications@github.com wrote:

The program does not terminate:

Stans-iMac-Pro:collect16 warford$ pep9term cpurun --mc 01Prob1228.pepcpu -p Prob1228-Unit-1.pepcpu Program assembled successfully. Preconditions assembled successfully. Passed unit tests. ^C

I must to terminate

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/StanWarford/pep9suite/issues/87?email_source=notifications&email_token=AIPV3AM576YFAUDSGZ3VW63Q27GUTA5CNFSM4J6ZUTV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYTIBA#issuecomment-569455620, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPV3AO6FH2JNXGK7B6JQ4TQ27GUTANCNFSM4J6ZUTVQ .

StanWarford commented 4 years ago

Done. Also, I cannot redirect the output. Is it streamed to std cout?

Matthew-McRaven commented 4 years ago

I think it’s streaming to STDERR via qDebug, let me check.

On Sat, Dec 28, 2019 at 15:24 Stan Warford notifications@github.com wrote:

Done. Also, I cannot redirect the output. Is it streamed to std out?

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/StanWarford/pep9suite/issues/87?email_source=notifications&email_token=AIPV3ALWEZLLIZLKZHZJIKDQ27NZ3A5CNFSM4J6ZUTV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYUBLA#issuecomment-569458860, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPV3AKG37P4YO4TFJ32EKLQ27NZ3ANCNFSM4J6ZUTVQ .

Matthew-McRaven commented 4 years ago

On Windows, the process terminates correctly. On my Mac, running OS X 10.14.6 and Qt 5.13.2, the given program terminates.

Did you build from the sources, or did you use one of my provided images?

StanWarford commented 4 years ago

It is terminating correctly now with no apparent changes. Still cannot redirect output. Using posted image.

Matthew-McRaven commented 4 years ago

What are you redirecting output to? The modes “asm” and “run” supposedly generate no redirectable output, and the newer modes follow this design.

On Sat, Dec 28, 2019 at 20:26 Stan Warford notifications@github.com wrote:

It is terminating correctly now with no apparent changes. Still cannot redirect output.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/StanWarford/pep9suite/issues/87?email_source=notifications&email_token=AIPV3AMLMGGTTAU6DKWYA7LQ3ARIDA5CNFSM4J6ZUTV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYXURI#issuecomment-569473605, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPV3ANKJDI5GN6CCFDBIODQ3ARIDANCNFSM4J6ZUTVQ .

StanWarford commented 4 years ago

OK, now I see. I used the -o option with asm mode. I thought I had redirected output. I will use -o. Should be fine.

Matthew-McRaven commented 4 years ago

There is no -o option, since the CPU generates no output. The CPU cannot generate any output (no memory mapped io at the CPU later), and we have no object code format.

The only option is to generate errors, either syntax errors or post condition errors.

In either case, they go to the error log.

On Sat, Dec 28, 2019 at 21:39 Stan Warford notifications@github.com wrote:

OK, now I see. I used the -o option with asm mode. I thought I had redirected output. I will use -o. Should be fine.

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/StanWarford/pep9suite/issues/87?email_source=notifications&email_token=AIPV3AMRTNGLL2P2A7U7C53Q3AZ2HA5CNFSM4J6ZUTV2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEHYYOGQ#issuecomment-569476890, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIPV3AOMWNKNJRABR4GF3SLQ3AZ2HANCNFSM4J6ZUTVQ .

StanWarford commented 4 years ago

OK, makes sense. So my script will check for the existence of the error log and will either use it or echo it's own "success" text. (I had not tested with an incorrect UnitPost.)

StanWarford commented 4 years ago

I injected a run-time error in a .pepcpu file and pep9term crashed:

Program assembled successfully. Preconditions assembled successfully. Data section reporting an error The CPU failed for the following reason: No value on C Bus to clock in. QIODevice::write (QFile, "/Users/warford/Documents/Classes/cs425/collect/collect16/01Prob1228_errLog.txt"): device not open

Here's the source file. Error is on line 10. Should be AMux=0

01Prob1228.pepcpu.txt

Matthew-McRaven commented 4 years ago

I think I fixed the bug in 2a6ef7905a283ce5b4a3916b0ae6603132824c9f. I'll have uploaded the new version of Pep9Term to the "releases" tab.

StanWarford commented 4 years ago

Tested OK. Looks good.