步骤A:isa+toml 新增 RS_OFF 形态(LOAD_PTR/STORE_PTR,0010 前缀 op=8/9)+ 强校验放行 + isa_test roundtrip
This commit is contained in:
@@ -669,6 +669,24 @@ func = "full"
|
||||
params = ["slot", "off", "rs"]
|
||||
enabled = true
|
||||
|
||||
[[op]]
|
||||
name = "LOAD_PTR"
|
||||
prefix = "0010"
|
||||
op = 8
|
||||
fmt = "RS+off"
|
||||
func = "full"
|
||||
params = ["rd", "rs", "off"]
|
||||
enabled = true
|
||||
|
||||
[[op]]
|
||||
name = "STORE_PTR"
|
||||
prefix = "0010"
|
||||
op = 9
|
||||
fmt = "RS+off"
|
||||
func = "full"
|
||||
params = ["rd", "rs", "off"]
|
||||
enabled = true
|
||||
|
||||
[[op]]
|
||||
name = "STR_LEN"
|
||||
prefix = "0010"
|
||||
|
||||
@@ -89,6 +89,7 @@ namespace {
|
||||
if (fmt == "CALL") return 1;
|
||||
if (fmt == "CAL") return 2;
|
||||
if (fmt == "SLOT+off") return 3;
|
||||
if (fmt == "RS+off") return 3;
|
||||
if (fmt == "IMM64") return 2;
|
||||
if (fmt == "预留") return 0;
|
||||
return -1;
|
||||
@@ -132,7 +133,7 @@ namespace {
|
||||
if (prefix == "010011") return "JC";
|
||||
if (prefix == "010100") return "CALL";
|
||||
if (prefix == "010101") return "CAL";
|
||||
if (prefix == "0010") return "SLOT+off";
|
||||
if (prefix == "0010") return "SLOT+off"; // 或 RS+off(LOAD_PTR/STORE_PTR)
|
||||
if (prefix == "0011") return "IMM64";
|
||||
if (prefix == "0001") return "预留";
|
||||
return "";
|
||||
@@ -392,9 +393,12 @@ bool MachineConfig::load(const std::string& path, std::string* err) {
|
||||
fail(err, "op '" + op.name + "': bad prefix '" + op.prefix + "'");
|
||||
return false;
|
||||
}
|
||||
// prefix ↔ fmt 互锁
|
||||
// prefix ↔ fmt 互锁(0010 允许 SLOT+off 与 RS+off 两种形态)
|
||||
const char* want_fmt = fmt_of_prefix(op.prefix);
|
||||
if (want_fmt == nullptr || op.fmt != want_fmt) {
|
||||
const bool ok_fmt =
|
||||
op.fmt == want_fmt ||
|
||||
(op.prefix == "0010" && op.fmt == "RS+off");
|
||||
if (!ok_fmt) {
|
||||
fail(err, "op '" + op.name + "': prefix '" + op.prefix +
|
||||
"' must pair with fmt '" + std::string(want_fmt ? want_fmt : "?") + "'");
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user