forked from starcells/R8VeritasCC
[err]202607242108
This commit is contained in:
1 parent
a46246810c
commit
491e8a86eb
2 files changed
+26
-4
No files matched your search
@@ -16,7 +16,7 @@
|
||||
|
||||
#define INS_SIZE (CELL_SIZE + 1)
|
||||
// mask and bytecode
|
||||
#define INS_BYTECODE_SIZE (CELL_SIZE + 1 + CELL_SIZE_BITWIDTH)
|
||||
#define INS_BYTECODE_SIZE (INS_SIZE + CELL_SIZE_BITWIDTH)
|
||||
// mask,bytecode and sacrifice
|
||||
|
||||
namespace r8veritas {
|
||||
|
||||
+25
-3
@@ -1,7 +1,9 @@
|
||||
#include "r8veritas.hh"
|
||||
#include <algorithm>
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
#include <ostream>
|
||||
#include <queue>
|
||||
#include <utility>
|
||||
|
||||
@@ -37,8 +39,8 @@ std::pair<r8veritas::stat, bool> operate_ins(const r8veritas::stat &last_stat,
|
||||
}
|
||||
}
|
||||
}
|
||||
visited_stat.insert_or_assign(key, next_stat);
|
||||
visited_op.insert_or_assign(next_stat, std::move(key));
|
||||
visited_stat.insert(std::pair(key, next_stat));
|
||||
visited_op.insert(std::pair(next_stat, std::move(key)));
|
||||
return {next_stat, false};
|
||||
}
|
||||
|
||||
@@ -49,6 +51,26 @@ std::ostream &operator<<(std::ostream &os, const r8veritas::stat &s) {
|
||||
return (os);
|
||||
}
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const r8veritas::ins &s) {
|
||||
|
||||
auto str = std::bitset<INS_SIZE>(s.bc).to_string();
|
||||
std::reverse(str.begin(), str.end());
|
||||
os << s.bc << ":{";
|
||||
if ((s.bc != 0b0) && (s.bc != 0b1)) {
|
||||
os << "OPERATION:";
|
||||
if (str[0] == '0')
|
||||
os << "SET1: ";
|
||||
else
|
||||
os << "FLIP: ";
|
||||
for (r8veritas::index i = 1; i < str.length(); i++) {
|
||||
if (str[i] == '1')
|
||||
os << i << " ";
|
||||
}
|
||||
}
|
||||
os << ",SACRIFICE:" << s.sacrifice << "}";
|
||||
return (os);
|
||||
}
|
||||
|
||||
r8veritas::truthtable
|
||||
compress_stat_space(const r8veritas::truthtable &raw_truthtable) {
|
||||
std::array<r8veritas::influence, CELL_SIZE> influences;
|
||||
@@ -107,7 +129,7 @@ r8veritas::path track_path(const r8veritas::truthtable &truthtable) {
|
||||
for (auto tmp_stat = truthtable.second; tmp_stat != truthtable.first;) {
|
||||
p.push(visited_op[tmp_stat]);
|
||||
tmp_stat = p.top().first;
|
||||
std::cout << tmp_stat << ";" << p.top().second << std::endl;
|
||||
std::cout << r8veritas::ins(p.top().second) << std::endl;
|
||||
}
|
||||
return p;
|
||||
}
|
||||
Reference in new issue
Block a user