-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* README.md: Fix call to kriscv run * Check output of run_pattern for better error messages * Fix >>aWord and >>lWord to account for >>Int requiring infinite sign extension to properly do an arithmetic shift * Sign extend the LUI immediate for when XLEN > 32 * Update CHECK_HALT rules to only apply when we haven't halted already * Add macros for simple tests * Refactor simple tests to have a YAML assertion file instead of the full configuration output * Fold addi-overflow.S into addi.S * Implement SLTI and SLTIU * Implement ANDI, ORI, and XORI * Implement SLLI, SRLI, and SRAI * Implement AUIPC and ADD * Implement SUB, SLT, SLTU, AND, OR, and XOR * Implement SLL, SRL, and SRA * Implement JAL * Implement JALR * Implement BEQ, BNE, BLT, BGE, BLTU, and BGEU * Implement LB, LH, LW, LBU, LHU, SB, SH, and SW * Implement FENCE, FENCE.TSO, ECALL, and EBREAK * Refactor the halting mechanism to make it possible to cleanly halt at any point, as will be necessary for, e.g., illegal instruction exceptions. * Pull the PC increment out into a separate pipeline step * Use a branchPC function for branch instrs rather than two separate rules * Set Version: 0.1.20 * Add comments explaining why the arithmetic >>Int is used to implement the logical >>lWord --------- Co-authored-by: devops <[email protected]>
- Loading branch information
1 parent
280f3d0
commit 606f33b
Showing
77 changed files
with
973 additions
and
175 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.19 | ||
0.1.20 |
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 |
---|---|---|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api" | |
|
||
[tool.poetry] | ||
name = "kriscv" | ||
version = "0.1.19" | ||
version = "0.1.20" | ||
description = "K tooling for the RISC-V architecture" | ||
authors = [ | ||
"Runtime Verification, Inc. <[email protected]>", | ||
|
Large diffs are not rendered by default.
Oops, something went wrong.
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,36 @@ | ||
from __future__ import annotations | ||
|
||
from typing import TYPE_CHECKING | ||
|
||
from pyk.kore.match import kore_int, match_app, match_symbol | ||
from pyk.kore.syntax import App | ||
|
||
if TYPE_CHECKING: | ||
from pyk.kore.syntax import Pattern | ||
|
||
|
||
def kore_word(word: Pattern) -> int: | ||
return kore_int(match_app(word, 'LblW').args[0]) | ||
|
||
|
||
def strip_inj(pattern: Pattern) -> Pattern: | ||
if isinstance(pattern, App) and pattern.symbol == 'inj': | ||
return pattern.args[0] | ||
return pattern | ||
|
||
|
||
def match_map(pattern: Pattern) -> tuple[tuple[Pattern, Pattern], ...]: | ||
# Same as match_map from pyk.kore.match, but not using LeftAssoc and stripping injections | ||
stop_symbol = "Lbl'Stop'Map" | ||
cons_symbol = "Lbl'Unds'Map'Unds'" | ||
item_symbol = "Lbl'UndsPipe'-'-GT-Unds'" | ||
|
||
app = match_app(pattern) | ||
if app.symbol == stop_symbol: | ||
return () | ||
|
||
if app.symbol == item_symbol: | ||
return ((strip_inj(app.args[0]), strip_inj(app.args[1])),) | ||
|
||
match_symbol(app.symbol, cons_symbol) | ||
return match_map(app.args[0]) + match_map(app.args[1]) |
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,14 @@ | ||
#include "simple.h" | ||
|
||
START_TEXT | ||
li x1, 0xDEADBEEF // x1 = 0xDEADBEEF | ||
add x2, x1, x0 // x2 = 0xDEADBEEF | ||
|
||
xori x3, x1, -1 // x3 = ~x2 | ||
addi x3, x3, 1 // x3 = ~x2 + 1 = -x2 | ||
li x4, 0xFFFFFFFF // x4 = 0xFFFFFFFF | ||
add x4, x4, x3 // x4 = 0xFFFFFFFF - x2 | ||
addi x4, x4, 1 // x4 = (0xFFFFFFFF - x2) + 1 | ||
|
||
add x5, x2, x4 // x5 = 0xFFFFFFFF + 1 = 0 | ||
END_TEXT |
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 @@ | ||
regs: {2: 0xDEADBEEF, 5: 0} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.