-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from Emoun/master
Fix reading of input on MacOs
- Loading branch information
Showing
11 changed files
with
109 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
#!/usr/bin/expect | ||
# This script should be run by Expect and not a shell. | ||
# See: https://linux.die.net/man/1/expect | ||
# It executes pasim, giving it the input specified through stdin | ||
# using an interactive session (not piped, which would not be interactive.) | ||
# | ||
# Takes 3 arguments: | ||
# 1. Path to pasim executable. | ||
# 2. Path to binary program that pasim is to run. | ||
# 3. Path to a file containing the input to pass to pasim's stdin using an interactive session. | ||
# | ||
# Notes: | ||
# | ||
# pasim has 2 seconds to run the program to completion, otherwise this script will | ||
# terminate it. | ||
# | ||
# The output of this script is the stdout of pasim. | ||
# | ||
# The exit code of this script is always 0, regardless of the exit code of pasim. | ||
# | ||
# Example call of this script: | ||
# | ||
# $ expect <script name> -- pasim program.bin input_file | ||
|
||
set pasim [lindex $argv 0]; | ||
set program [lindex $argv 1]; | ||
set input [lindex $argv 2]; | ||
# 2 second timeout when this script ends. | ||
set timeout 2 | ||
|
||
# Spawn program | ||
spawn -noecho $pasim -V --maxc 40000 $program | ||
|
||
# Send it some input | ||
send [exec cat $input] | ||
|
||
# Send program output to stdout | ||
expect full_buffer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
� | ||
A |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,21 @@ | ||
# | ||
# Expected Result: r1 = 0xfb | ||
# Continualy checks the status flag of the UART until | ||
# it signals there is some input, which is then loaded into r1. | ||
# Expected Result: r1 = 0x41 | ||
# | ||
|
||
.word 64; | ||
add r1 = r0, 0xF0080000; | ||
addi r2 = r0, 2; | ||
lwl r3 = [r1 + 0]; | ||
nop; | ||
nop; | ||
andi r3 = r3, 2; | ||
cmpneq p1 = r3, r2; | ||
(p1) br -3; | ||
(p1) br -4; | ||
nop; | ||
nop; | ||
lwl r1 = [r1 + 1]; | ||
halt; | ||
nop; | ||
nop; | ||
nop; | ||
nop; | ||
nop; | ||
nop; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,20 @@ | ||
# | ||
# Checks the UART status flag for whether it is ready to | ||
# receive data. If so, the program outputs '!' to the UART | ||
# (which should be seen in stdout.) | ||
# Expected Result: '!' is output, and r2 = 0x21 | ||
# | ||
|
||
.word 68; | ||
.word 56; | ||
add r1 = r0, 0xF0080000; | ||
addi r2 = r0, 1; | ||
lwl r3 = [r1 + 0]; | ||
nop; | ||
nop; | ||
andi r3 = r3, 1; | ||
cmpneq p1 = r3, r2; | ||
(p1) br -3; | ||
(!p1) addi r2 = r0, 0x21; | ||
(!p1) swl [r1 + 1] = r2; | ||
halt; | ||
nop; | ||
nop; | ||
nop; | ||
addi r2 = r0, 0x21; | ||
swl [r1 + 1] = r2; | ||
halt; | ||
nop; | ||
nop; | ||
nop; |