bit_add
This commit is contained in:
1 parent
3e873c4f8e
commit
72b7bf89a2
3 files changed
+22
-24
No files matched your search
@@ -111,19 +111,19 @@ std::pair<r8veritas::stat_ref, bool>
|
||||
operate_ins(const r8veritas::stat_ref &last_stat, const r8veritas::ins &ins);
|
||||
// true means that {stat,ins} has been operated.
|
||||
|
||||
static std::unordered_map<
|
||||
inline std::unordered_map<
|
||||
std::pair<r8veritas::stat_ref, r8veritas::ins_bytecode>,
|
||||
r8veritas::stat_ref>
|
||||
visited_stat;
|
||||
|
||||
static std::unordered_map<
|
||||
inline std::unordered_map<
|
||||
r8veritas::stat_ref,
|
||||
std::pair<r8veritas::stat_ref, r8veritas::ins_bytecode>>
|
||||
visited_op;
|
||||
|
||||
static std::unordered_set<r8veritas::stat> stat_pool;
|
||||
static std::array<std::string, CELL_SIZE> default_nicknames;
|
||||
static std::array<std::string, CELL_SIZE> tp_paths;
|
||||
inline std::unordered_set<r8veritas::stat> stat_pool;
|
||||
inline std::array<std::string, CELL_SIZE> nicknames;
|
||||
inline std::array<std::string, CELL_SIZE> tp_paths;
|
||||
|
||||
std::ostream &operator<<(std::ostream &os, const r8veritas::stat &s);
|
||||
|
||||
@@ -136,7 +136,6 @@ bool bfs(const r8veritas::truthtable &truthtable, r8veritas::index layer = 1);
|
||||
r8veritas::path track_path(const r8veritas::truthtable &truthtable);
|
||||
std::ostream &operator<<(std::ostream &os, const r8veritas::stat_ref &s);
|
||||
std::ostream &operator<<(std::ostream &os, const r8veritas::ins &s);
|
||||
std::array<std::string, CELL_SIZE> initialize_nicknames();
|
||||
std::array<std::string, CELL_SIZE>
|
||||
initialize_tp_paths(std::array<std::string, CELL_SIZE> nickname_list);
|
||||
void initialize_nicknames();
|
||||
void initialize_tp_paths();
|
||||
#endif
|
||||
+7
-11
@@ -3,28 +3,24 @@
|
||||
#include <array>
|
||||
#include <bitset>
|
||||
#include <iostream>
|
||||
#include <iterator>
|
||||
#include <ostream>
|
||||
#include <queue>
|
||||
#include <string>
|
||||
#include <unordered_set>
|
||||
#include <utility>
|
||||
std::array<std::string, CELL_SIZE> initialize_nicknames() {
|
||||
std::array<std::string, CELL_SIZE> arr;
|
||||
void initialize_nicknames() {
|
||||
for (r8veritas::index i = 0; i < CELL_SIZE; i++) {
|
||||
arr[i] = std::to_string(i + 1);
|
||||
nicknames[i] = "%" + std::to_string(i + 1);
|
||||
}
|
||||
return (arr);
|
||||
return;
|
||||
}
|
||||
|
||||
std::array<std::string, CELL_SIZE>
|
||||
initialize_tp_paths(std::array<std::string, CELL_SIZE> nickname_list) {
|
||||
std::array<std::string, CELL_SIZE> arr;
|
||||
void initialize_tp_paths() {
|
||||
for (r8veritas::index i = 0; i < CELL_SIZE; i++) {
|
||||
arr[i] = ".tp %" + nickname_list[i];
|
||||
tp_paths[i] = ".tp " + nicknames[i];
|
||||
}
|
||||
|
||||
return (arr);
|
||||
return;
|
||||
}
|
||||
|
||||
r8veritas::stat_ref generate_empty_stat() {
|
||||
@@ -156,7 +152,7 @@ bool bfs(const r8veritas::truthtable &truthtable, r8veritas::index layer) {
|
||||
}
|
||||
|
||||
r8veritas::index i = stats.size();
|
||||
std::cout << "LAYER=" << layer << ",stats_size=" << i << std::endl;
|
||||
// std::cout << "LAYER=" << layer << ",stats_size=" << i << std::endl;
|
||||
r8veritas::stat_ref tmp_stat_ref;
|
||||
std::pair<r8veritas::stat_ref, bool> tmp_ans;
|
||||
auto operated = false;
|
||||
|
||||
+8
-5
@@ -30,9 +30,10 @@ r8veritas::cell func_full_add_S(r8veritas::cell inp) {
|
||||
}
|
||||
|
||||
int main() {
|
||||
default_nicknames = initialize_nicknames();
|
||||
tp_paths = initialize_tp_paths(default_nicknames);
|
||||
auto tab1 = generate_truthtable(func_and);
|
||||
initialize_nicknames();
|
||||
initialize_tp_paths();
|
||||
|
||||
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);
|
||||
@@ -41,7 +42,9 @@ int main() {
|
||||
p.pop();
|
||||
}
|
||||
}
|
||||
/*
|
||||
|
||||
nicknames[4] = "bit_add_buf_1";
|
||||
initialize_tp_paths();
|
||||
auto tab2 = generate_truthtable(func_full_add_S);
|
||||
auto new_tab2 = compress_stat_space(tab2);
|
||||
if (bfs(new_tab2)) {
|
||||
@@ -50,6 +53,6 @@ int main() {
|
||||
std::cout << r8veritas::to_ins(p.top().second) << std::endl;
|
||||
p.pop();
|
||||
}
|
||||
}*/
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
Reference in new issue
Block a user