[err]202607251632

This commit is contained in:
starcells committed 2026-07-25 16:32:47 +08:00
1 parent edc2c63f14
commit 50480ffe04
3 files changed
+30 -8

No files matched your search

+1 -1
View File
@@ -12,7 +12,7 @@
#include <unordered_set>
#include <utility>
#define CELL_SIZE 8
#define CELL_SIZE 5
#define CELL_SIZE_BITWIDTH std::bit_width(unsigned(CELL_SIZE))
#define INS_SIZE (CELL_SIZE + 1)
+4
View File
@@ -133,6 +133,10 @@ bool bfs(const r8veritas::truthtable &truthtable, r8veritas::index layer) {
for (auto j : r8veritas::all_ins) {
tmp_ans = operate_ins(tmp_stat_ref, j);
if (tmp_ans.first == truthtable.second) {
while (!stats.empty())
stats.pop();
remembered_stats.erase(remembered_stats.begin(),
remembered_stats.end());
return (true);
}
if (!((tmp_ans.second) || remembered_stats.contains(tmp_ans.first))) {
+25 -7
View File
@@ -11,20 +11,38 @@ r8veritas::cell func_copy(r8veritas::cell inp) {
return (((inp & 1) << 1) | (inp & 1)); // inp[0] -> from,inp[1]->to
}
r8veritas::cell func_full_add(r8veritas::cell inp) {
r8veritas::cell func_full_add_Co(r8veritas::cell inp) {
bool A = inp & 0b1;
bool B = inp & 0b10;
bool C = inp & 0b100;
bool S = A ^ B ^ C;
bool Ci = (A & B) | (A & C) | (B & C);
return (Ci << 4 | S << 3) | (inp & 0b111);
bool Co = (A & B) | (A & C) | (B & C);
return (Co << 4) | (inp & 0b111);
}
r8veritas::cell func_full_add_S(r8veritas::cell inp) {
bool A = inp & 0b1;
bool B = inp & 0b10;
bool C = inp & 0b100;
bool S = A ^ B ^ C;
bool Co = (A & B) | (A & C) | (B & C);
return (S << 3) | (inp & 0b111);
}
int main() {
auto tab = generate_truthtable(func_full_add);
auto new_tab = compress_stat_space(tab);
if (bfs(new_tab)) {
r8veritas::path p = track_path(tab);
auto tab1 = generate_truthtable(func_full_add_Co);
auto new_tab1 = compress_stat_space(tab1);
if (bfs(new_tab1)) {
r8veritas::path p = track_path(tab1);
while (!p.empty()) {
std::cout << r8veritas::to_ins(p.top().second) << std::endl;
p.pop();
}
}
auto tab2 = generate_truthtable(func_full_add_S);
auto new_tab2 = compress_stat_space(tab2);
if (bfs(new_tab2)) {
r8veritas::path p = track_path(tab2);
while (!p.empty()) {
std::cout << r8veritas::to_ins(p.top().second) << std::endl;
p.pop();