Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Support defects in SiQAD coordinates for layout reading and writing #269

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
9622e83
:arrow_up: Bump libs/Catch2 from `6783411` to `1f881ab` (#27)
dependabot[bot] Apr 2, 2023
2da4f7e
Merge branch 'marcelwa:main' into main
Drewniok Apr 14, 2023
8f5f52f
:arrow_up: Bump libs/parallel-hashmap from `7883cb6` to `d2bed96` (#33)
dependabot[bot] Apr 14, 2023
a8cbc27
Merge branch 'marcelwa:main' into main
Drewniok Apr 18, 2023
3b11f93
Merge branch 'marcelwa:main' into main
Drewniok Apr 18, 2023
e9e2fa3
Merge branch 'marcelwa:main' into main
Drewniok Apr 18, 2023
37c881e
Merge branch 'marcelwa:main' into main
Drewniok Apr 19, 2023
4aa8489
Merge branch 'marcelwa:main' into main
Drewniok Apr 19, 2023
1587ef3
Merge branch 'marcelwa:main' into main
Drewniok Apr 20, 2023
04ed1c3
Merge branch 'marcelwa:main' into main
Drewniok Apr 21, 2023
9eaaf1f
Merge branch 'marcelwa:main' into main
Drewniok Apr 25, 2023
0dca9cf
Merge branch 'marcelwa:main' into main
Drewniok Apr 26, 2023
ce8b2e2
Merge branch 'marcelwa:main' into main
Drewniok May 1, 2023
64501c1
Merge branch 'marcelwa:main' into main
Drewniok May 10, 2023
68f6885
Merge branch 'marcelwa:main' into main
Drewniok May 11, 2023
84634cd
Merge branch 'marcelwa:main' into main
Drewniok May 12, 2023
597b1a7
Merge branch 'marcelwa:main' into main
Drewniok May 12, 2023
1920794
Merge branch 'marcelwa:main' into main
Drewniok May 14, 2023
5d74ac6
Merge branch 'marcelwa:main' into main
Drewniok May 21, 2023
f408962
Merge branch 'marcelwa:main' into main
Drewniok May 24, 2023
b4138de
Merge branch 'marcelwa:main' into main
Drewniok May 25, 2023
930fcf2
Merge branch 'marcelwa:main' into main
Drewniok Jun 5, 2023
cbd8345
Merge branch 'marcelwa:main' into main
Drewniok Jun 7, 2023
2903532
Merge branch 'marcelwa:main' into main
Drewniok Jun 12, 2023
f70ceb6
Merge branch 'marcelwa:main' into main
Drewniok Jun 14, 2023
24ff3a7
Merge branch 'marcelwa:main' into main
Drewniok Jun 16, 2023
a4f3150
Merge branch 'marcelwa:main' into main
Drewniok Jun 19, 2023
9c78984
Merge branch 'marcelwa:main' into main
Drewniok Jun 23, 2023
c3f4e96
Merge branch 'marcelwa:main' into main
Drewniok Jun 28, 2023
853be74
Merge branch 'cda-tum:main' into main
Drewniok Jul 5, 2023
13eab3c
Merge branch 'cda-tum:main' into main
Drewniok Jul 10, 2023
1c59a58
Merge branch 'cda-tum:main' into main
Drewniok Jul 18, 2023
1f87c22
Merge branch 'cda-tum:main' into main
Drewniok Jul 20, 2023
d300bc1
Merge branch 'cda-tum:main' into main
Drewniok Jul 24, 2023
2dc75ac
Merge branch 'cda-tum:main' into main
Drewniok Jul 25, 2023
9fc5819
Merge branch 'cda-tum:main' into main
Drewniok Jul 26, 2023
bd5cfc3
Merge branch 'cda-tum:main' into main
Drewniok Jul 26, 2023
51b93cb
Merge branch 'cda-tum:main' into main
Drewniok Jul 26, 2023
751369c
Merge branch 'cda-tum:main' into main
Drewniok Aug 3, 2023
311339b
Merge branch 'cda-tum:main' into main
Drewniok Aug 10, 2023
16c12e4
Merge branch 'cda-tum:main' into main
Drewniok Aug 27, 2023
9f4426b
Merge branch 'cda-tum:main' into main
Drewniok Aug 29, 2023
1ed3310
:sparkles: support defects in siqad coordinates for layout reading an…
Drewniok Aug 29, 2023
fdd8cc2
Merge branch 'main' into add_defect_siqad_support_write_sqd_layout
Drewniok Aug 29, 2023
6156499
:art: avoid double negation.
Drewniok Aug 29, 2023
a3c5459
Merge branch 'main' into add_defect_siqad_support_write_sqd_layout
Drewniok Aug 30, 2023
6eccd58
Merge branch 'cda-tum:main' into main
Drewniok Aug 30, 2023
adfccce
Merge branch 'main' into add_defect_siqad_support_write_sqd_layout
Drewniok Aug 30, 2023
7e12fdf
:white_check_mark: add additional unit test.
Drewniok Aug 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion include/fiction/io/read_sqd_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -278,7 +278,14 @@ class read_sqd_layout_impl
for (const auto* latcoord = incl_coords->FirstChildElement("latcoord"); latcoord != nullptr;
latcoord = latcoord->NextSiblingElement("latcoord"))
{
incl_cells.push_back(parse_latcoord(latcoord));
if constexpr (has_siqad_coord_v<Lyt>)
{
incl_cells.push_back(parse_latcoord_siqad(latcoord));
}
else
{
incl_cells.push_back(parse_latcoord(latcoord));
}
}
if (incl_cells.empty())
{
Expand Down
46 changes: 36 additions & 10 deletions include/fiction/io/write_sqd_layout.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -221,9 +221,19 @@ class write_sqd_layout_impl
// generate SiDB cells
if constexpr (has_sidb_technology_v<Lyt>)
{
design << fmt::format(siqad::DBDOT_BLOCK,
fmt::format(siqad::LATTICE_COORDINATE, c.x, c.y / 2, c.y % 2),
siqad::NORMAL_COLOR);
if constexpr (has_siqad_coord_v<Lyt>)
{
design << fmt::format(siqad::DBDOT_BLOCK, fmt::format(siqad::LATTICE_COORDINATE, c.x, c.y, c.z),
siqad::NORMAL_COLOR);
}
else
{
design << fmt::format(
siqad::DBDOT_BLOCK,
fmt::format(siqad::LATTICE_COORDINATE, fiction::siqad::to_siqad_coord(c).x,
fiction::siqad::to_siqad_coord(c).y, fiction::siqad::to_siqad_coord(c).z),
siqad::NORMAL_COLOR);
}
}
// generate QCA cell blocks
else if constexpr (has_qca_technology_v<Lyt>)
Expand Down Expand Up @@ -273,15 +283,31 @@ class write_sqd_layout_impl
lyt.foreach_sidb_defect(
[&design](const auto& cd)
{
const auto& cell = cd.first;
const auto& defect = cd.second;

design << fmt::format(siqad::DEFECT_BLOCK,
fmt::format(siqad::LATTICE_COORDINATE, cell.x, cell.y / 2, cell.y % 2),
is_charged_defect(defect) ? fmt::format(siqad::COULOMB, defect.charge,
defect.epsilon_r, defect.lambda_tf) :
"",
get_defect_type_name(defect.type));
// layout is not based on siqad coordinates, coordinate transformation is performed
if constexpr (has_siqad_coord_v<Lyt>)
{
const auto& cell = cd.first;

design << fmt::format(
siqad::DEFECT_BLOCK, fmt::format(siqad::LATTICE_COORDINATE, cell.x, cell.y, cell.z),
is_charged_defect(defect) ?
fmt::format(siqad::COULOMB, defect.charge, defect.epsilon_r, defect.lambda_tf) :
"",
get_defect_type_name(defect.type));
}
else
{
const auto cell = fiction::siqad::to_siqad_coord(cd.first);

design << fmt::format(
siqad::DEFECT_BLOCK, fmt::format(siqad::LATTICE_COORDINATE, cell.x, cell.y, cell.z),
is_charged_defect(defect) ?
fmt::format(siqad::COULOMB, defect.charge, defect.epsilon_r, defect.lambda_tf) :
"",
get_defect_type_name(defect.type));
}
});
}
}
Expand Down
56 changes: 56 additions & 0 deletions test/io/write_sqd_layout.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <fiction/technology/sidb_defects.hpp>
#include <fiction/technology/sidb_surface.hpp>
#include <fiction/traits.hpp>
#include <fiction/types.hpp>

#include <map>
#include <sstream>
Expand Down Expand Up @@ -175,3 +176,58 @@ TEST_CASE("Write defective surface SQD layout", "[sqd]")

compare_written_and_read_layout(defect_layout, read_layout);
}

TEST_CASE("Write multi-dot SQD layout based on SiQAD coordinates", "[sqd]")
{
sidb_cell_clk_lyt_siqad layout{{4, 4}};
layout.assign_cell_type({0, 0}, sidb_technology::cell_type::NORMAL);
layout.assign_cell_type({1, 1}, sidb_technology::cell_type::NORMAL);
layout.assign_cell_type({0, 2}, sidb_technology::cell_type::NORMAL);
layout.assign_cell_type({0, 3}, sidb_technology::cell_type::NORMAL);
layout.assign_cell_type({4, 4}, sidb_technology::cell_type::NORMAL);

std::stringstream layout_stream{};

write_sqd_layout(layout, layout_stream);

const auto read_layout = read_sqd_layout<sidb_cell_clk_lyt_siqad>(layout_stream);

compare_written_and_read_layout(layout, read_layout);
}

TEST_CASE("Write defective surface SQD layout based on SiQAD coordinates", "[sqd]")
{
static const std::map<cell<sidb_cell_clk_lyt_siqad>, sidb_defect> defect_map{
{{{0, 0, 1}, sidb_defect{sidb_defect_type::NONE}},
{{0, 1}, sidb_defect{sidb_defect_type::DB}},
{{0, 2}, sidb_defect{sidb_defect_type::SI_VACANCY}},
{{0, 3}, sidb_defect{sidb_defect_type::SINGLE_DIHYDRIDE}},
{{0, 4, 1}, sidb_defect{sidb_defect_type::DIHYDRIDE_PAIR}},
{{0, 5, 1}, sidb_defect{sidb_defect_type::ONE_BY_ONE}},
{{0, 6}, sidb_defect{sidb_defect_type::THREE_BY_ONE}},
{{0, 7}, sidb_defect{sidb_defect_type::SILOXANE}},
{{0, 8}, sidb_defect{sidb_defect_type::RAISED_SI}},
{{0, 9}, sidb_defect{sidb_defect_type::MISSING_DIMER}},
{{0, 10, 1}, sidb_defect{sidb_defect_type::ETCH_PIT}},
{{0, 11}, sidb_defect{sidb_defect_type::STEP_EDGE}},
{{0, 12, 0}, sidb_defect{sidb_defect_type::GUNK}},
{{0, 13}, sidb_defect{sidb_defect_type::UNKNOWN}}}};

const sidb_cell_clk_lyt_siqad lyt{aspect_ratio<sidb_cell_clk_lyt_siqad>{0, defect_map.size() - 1}};

sidb_surface<sidb_cell_clk_lyt_siqad> defect_layout{lyt};

// assign defects
for (const auto& [c, d] : defect_map)
{
defect_layout.assign_sidb_defect(c, d);
}

std::stringstream layout_stream{};

write_sqd_layout(defect_layout, layout_stream);

const auto read_layout = read_sqd_layout<sidb_surface<sidb_cell_clk_lyt_siqad>>(layout_stream);

compare_written_and_read_layout(defect_layout, read_layout);
}
Loading