Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Symbolic Executor
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Blockchains
UTXO Chains
Symbolic Executor
Commits
09a58ee1
Commit
09a58ee1
authored
2 years ago
by
vincent
Browse files
Options
Downloads
Patches
Plain Diff
[BTC Language] Bug fix
* False is encoded over 0 byte. The operators were returning a value encoded over 1 byte.
parent
89f89e53
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
symbolic_execution/hardware/machines/btc_machine.py
+14
-10
14 additions, 10 deletions
symbolic_execution/hardware/machines/btc_machine.py
with
14 additions
and
10 deletions
symbolic_execution/hardware/machines/btc_machine.py
+
14
−
10
View file @
09a58ee1
...
...
@@ -143,49 +143,53 @@ class BTCVector:
self
.
BTC_TRUE
,
self
.
BTC_FALSE
,
),
IntVal
(
1
),
# True and False are always encoded on 1 byte.
If
(
And
(
self
.
val
==
other
.
val
,
self
.
size
==
other
.
size
),
IntVal
(
1
),
IntVal
(
0
),
),
)
def
__le__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val <= other.val`.
"""
return
BTCVector
(
If
(
self
.
val
<=
other
.
val
,
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
self
.
val
<=
other
.
val
,
IntVal
(
1
),
IntVal
(
0
)),
)
def
__lt__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val < other.val`.
"""
return
BTCVector
(
If
(
self
.
val
<
other
.
val
,
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
self
.
val
<
other
.
val
,
IntVal
(
1
),
IntVal
(
0
)),
)
def
__gt__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val > other.val`.
"""
return
BTCVector
(
If
(
self
.
val
>
other
.
val
,
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
self
.
val
>
other
.
val
,
IntVal
(
1
),
IntVal
(
0
)),
)
def
__ge__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val >= other.val`.
"""
return
BTCVector
(
If
(
self
.
val
>=
other
.
val
,
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
self
.
val
>=
other
.
val
,
IntVal
(
1
),
IntVal
(
0
)),
)
def
__and__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val != 0 and other.val != 0`.
"""
return
BTCVector
(
If
(
And
(
self
.
val
!=
0
,
other
.
val
!=
0
),
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
And
(
self
.
val
!=
0
,
other
.
val
!=
0
),
IntVal
(
1
),
IntVal
(
0
)),
)
def
__or__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val != 0 or other.val != 0`.
"""
return
BTCVector
(
If
(
Or
(
self
.
val
!=
0
,
other
.
val
!=
0
),
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
Or
(
self
.
val
!=
0
,
other
.
val
!=
0
),
IntVal
(
1
),
IntVal
(
0
)),
)
def
__min__
(
self
,
other
):
...
...
@@ -206,7 +210,7 @@ class BTCVector:
"""
Return the BTC vector `True` if `a.val <= self.val < b.val`.
"""
return
BTCVector
(
If
(
And
(
self
.
val
<
b
.
val
,
self
.
val
>=
a
.
val
),
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
And
(
self
.
val
<
b
.
val
,
self
.
val
>=
a
.
val
),
IntVal
(
1
),
IntVal
(
0
)),
)
def
__inc__
(
self
):
...
...
@@ -221,14 +225,14 @@ class BTCVector:
"""
If the input is 0 or 1, it is flipped. Otherwise the output will be 0.
"""
return
BTCVector
(
If
(
self
.
val
==
0
,
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
self
.
val
==
0
,
IntVal
(
1
),
IntVal
(
0
)),
)
def
__num_eq__
(
self
,
other
):
"""
Return the BTC vector `True` if `self.val == other.val`.
"""
return
BTCVector
(
If
(
self
.
val
==
other
.
val
,
self
.
BTC_TRUE
,
self
.
BTC_FALSE
),
I
ntVal
(
1
),
# True and False are always encoded on 1 byte.
I
f
(
self
.
val
==
other
.
val
,
IntVal
(
1
),
IntVal
(
0
)),
)
def
__size__
(
self
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment