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

remove unit tests from CMakeLists since those don't exist in pybag #7

Open
wants to merge 26 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
1d3b2aa
remove unit tests from CMakeLists since those don't exist in pybag
Sep 1, 2020
b6f9a19
update .gitmodules
Sep 3, 2020
7f9a9bf
AppTimeDef support for OA
hyunjaekwon Sep 19, 2020
ad8eb26
Merge pull request #1 from hyunjaekwon/apptimedef_support_for_oa
ayan-biswas Sep 23, 2020
4495f4c
Added vo/io to sinedc mapping for CDF to spectre
hyunjaekwon Oct 6, 2020
6c1fff7
Merge pull request #2 from hyunjaekwon/spectre_sinedc_prop_name_map
ayan-biswas Oct 6, 2020
81993ff
add via priority
May 9, 2021
540d7f8
support ipwlf, n1port, n2port, n3port, n4port in spectre.cpp
May 22, 2021
096e472
fix add_pin() for generated symbols
Jun 12, 2021
7f481cb
add optional label_purpose which is same as pin_purpose by default
Mar 23, 2022
4fae36a
add n8port in spectre.cpp
Mar 31, 2022
2c8fc01
support mutual inductor and n6port in spectre netlisting
Apr 25, 2022
94e9668
add n12port in cbag spectre netlister
May 24, 2022
c007b94
1. Update cellview_info to have new 'va' entry for veriloga module lo…
Aug 24, 2022
2e35f87
Merge pull request #3 from ucb-art/veriloga_support
ayan-biswas Sep 6, 2022
f18ae0a
create_lay_inst: spx and spy for arrayed instances need to be scaled …
Nov 30, 2022
3924df6
blockage.h and blockage.cpp: rename private variable 'layer' to 'laye…
Dec 20, 2022
ff11fb9
implement read_path() inside read_gds(); does not work for 45 degree …
Jan 13, 2023
9b5a332
add argument 'scale' in read_lay_cellview similar to write_lay_cellview
Jan 14, 2023
d301521
GDS read and write: support 45 degree paths that result in negative a…
Jan 16, 2023
631af72
fix parse_map for gds.layermap: ignore any entries after first 4 columns
Feb 24, 2023
bce189e
update GDS writing to preserve layout pins as Pin object
Apr 29, 2023
4e05a5d
handle path propattr during gds read
May 10, 2023
5aed951
1. fix pin order in generated netlists; 2. add pwlFile in spectre.cpp…
Jun 4, 2024
024f4cb
Merge pull request #4 from ayan-biswas/develop
FeliciaG Jun 6, 2024
84d99c9
Initial support for Ngspice (#5)
boblinchuan Jul 1, 2024
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
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "cbag_polygon"]
path = cbag_polygon
url = [email protected]:bluecheetah/cbag_polygon.git
url = [email protected]:ucb-art/cbag_polygon.git
5 changes: 2 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@ set(SRC_FILES_LIB_CBAG
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/label.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/len_info.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/lp_lookup.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/path.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/path_util.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/pin.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/layout/routing_grid.cpp
Expand All @@ -156,6 +157,7 @@ set(SRC_FILES_LIB_CBAG
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/core.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/lstream.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/netlist.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/ngspice.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/nstream_output.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/spectre.cpp
${CMAKE_CURRENT_SOURCE_DIR}/src/cbag/netlist/verilog.cpp
Expand Down Expand Up @@ -264,6 +266,3 @@ endif()

# add utility binaries
add_subdirectory(util EXCLUDE_FROM_ALL)

# add tests binaries
add_subdirectory(tests EXCLUDE_FROM_ALL)
2 changes: 1 addition & 1 deletion cbag_polygon
Submodule cbag_polygon updated 1 files
+0 −3 CMakeLists.txt
2 changes: 2 additions & 0 deletions include/cbag/enum/design_output.h
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ enum class design_output : enum_t {
VERILOG = 5,
SYSVERILOG = 6,
SPECTRE = 7,
OASIS = 8,
NGSPICE = 9,
};

} // namespace cbag
Expand Down
16 changes: 7 additions & 9 deletions include/cbag/gdsii/parse_map.h
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,13 @@ void process_layer_map(const std::string &fname, const layout::tech &tech, F fun
auto glay = to_int(iter.get_next(), fname, count);
check_has_next(iter, fname, count);
auto gpurp = to_int(iter.get_next(), fname, count);
if (!iter.has_next()) {
// if we still have values left, that means they are
// color specifications. Ignore those entries since
// we use MnCA/MnCB layers to denote colors.
auto lay = tech.get_layer_id(val1);
auto purp = tech.get_purpose_id(val2);
if (lay && purp) {
fun(std::make_pair(*lay, *purp), std::make_pair(glay, gpurp));
}
// if we still have values left, that means they are
// color specifications. Ignore those entries since
// we use MnCA/MnCB layers to denote colors.
auto lay = tech.get_layer_id(val1);
auto purp = tech.get_purpose_id(val2);
if (lay && purp) {
fun(std::make_pair(*lay, *purp), std::make_pair(glay, gpurp));
}
}
}
Expand Down
13 changes: 10 additions & 3 deletions include/cbag/gdsii/read.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,20 +98,27 @@ std::tuple<std::string, std::shared_ptr<layout::cellview>> read_lay_cellview(
spdlog::logger &logger, std::istream &stream, const std::string &lib_name,
const std::shared_ptr<const layout::routing_grid> &g,
const std::shared_ptr<const layout::track_coloring> &colors, const gds_rlookup &rmap,
const std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> &master_map);
const std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> &master_map, int scale);

template <class OutIter>
std::string
read_gds_stream(std::istream &stream, const std::string &layer_map, const std::string &obj_map,
const std::shared_ptr<const layout::routing_grid> &g,
const std::shared_ptr<const layout::track_coloring> &colors, OutIter &&out_iter) {
auto log_ptr = get_cbag_logger();
auto &tech = *(g->get_tech());

// get gds file stream
auto res = tech.get_resolution();
auto gds_res = tech.get_gds_resolution();
auto scale = static_cast<int>(std::round(res / gds_res));

// Unlike write_gds_start(), read_gds_start() does not require gds_res and user_unit,
// because those gds entries are skipped during reading.
auto lib_name = read_gds_start(*log_ptr, stream);
log_ptr->info("Reading GDS library: {}", lib_name);

gds_rlookup rmap(layer_map, obj_map, *(g->get_tech()));
gds_rlookup rmap(layer_map, obj_map, tech);
std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> cv_map;
while (true) {
auto[rtype, rsize] = read_record_header(stream);
Expand All @@ -120,7 +127,7 @@ read_gds_stream(std::istream &stream, const std::string &layer_map, const std::s
log_ptr->info("Reading GDS cellview");
stream.ignore(rsize);
auto[cell_name, cv_ptr] =
read_lay_cellview(*log_ptr, stream, lib_name, g, colors, rmap, cv_map);
read_lay_cellview(*log_ptr, stream, lib_name, g, colors, rmap, cv_map, scale);

cv_map.emplace(cell_name, cv_ptr);
*out_iter = std::move(cv_ptr);
Expand Down
20 changes: 12 additions & 8 deletions include/cbag/gdsii/read_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ limitations under the License.
#include <cbag/common/layer_t.h>
#include <cbag/common/point_t.h>
#include <cbag/common/transformation.h>
#include <cbag/common/typedefs.h>
#include <cbag/gdsii/record_type.h>
#include <cbag/gdsii/typedefs.h>
#include <cbag/layout/polygons.h>
Expand Down Expand Up @@ -124,7 +125,7 @@ void read_skip(std::istream &stream) {

std::tuple<record_type, std::size_t> read_record_header(std::istream &stream);

point_t read_point(std::istream &stream);
point_t read_point(std::istream &stream, int scale);

std::string read_inst_name(spdlog::logger &logger, std::istream &stream, std::size_t &cnt);

Expand All @@ -138,29 +139,32 @@ void read_units(spdlog::logger &logger, std::istream &stream);

std::string read_struct_name(spdlog::logger &logger, std::istream &stream);

transformation read_transform(spdlog::logger &logger, std::istream &stream);
transformation read_transform(spdlog::logger &logger, std::istream &stream, int scale);

std::tuple<transformation, double> read_transform_info(spdlog::logger &logger,
std::istream &stream);

std::tuple<uint16_t, uint16_t> read_col_row(spdlog::logger &logger, std::istream &stream);

std::tuple<gds_layer_t, transformation, std::string, double> read_text(spdlog::logger &logger,
std::istream &stream);
std::istream &stream,
double resolution, int scale);

std::tuple<gds_layer_t, layout::poly_t> read_box(spdlog::logger &logger, std::istream &stream);
std::tuple<gds_layer_t, layout::poly_t> read_box(spdlog::logger &logger, std::istream &stream, int scale);

std::tuple<gds_layer_t, layout::poly_t> read_boundary(spdlog::logger &logger, std::istream &stream);
std::tuple<gds_layer_t, layout::poly_t> read_boundary(spdlog::logger &logger, std::istream &stream, int scale);

gds_layer_t read_path(spdlog::logger &logger, std::istream &stream);
std::tuple<gds_layer_t, offset_t, enum_t, offset_t, offset_t, std::vector<point_t>> read_path(spdlog::logger &logger,
std::istream &stream,
int scale);

layout::instance read_instance(
spdlog::logger &logger, std::istream &stream, std::size_t &cnt,
const std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> &master_map);
const std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> &master_map, int scale);

layout::instance read_arr_instance(
spdlog::logger &logger, std::istream &stream, std::size_t &cnt,
const std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> &master_map);
const std::unordered_map<std::string, std::shared_ptr<const layout::cellview>> &master_map, int scale);

bool print_record(std::istream &stream);

Expand Down
2 changes: 2 additions & 0 deletions include/cbag/gdsii/record_type.h
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@ enum class record_type : uint16_t {
PROPVALUE = 0x2C06,
BOX = 0x2D00,
BOXTYPE = 0x2E02,
BEGINEXTN = 0x3003,
ENDEXTN = 0x3103,
};

constexpr auto PROP_INST_NAME = 1;
Expand Down
6 changes: 5 additions & 1 deletion include/cbag/gdsii/write_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ limitations under the License.
#include <string>

#include <cbag/common/box_t.h>
#include <cbag/common/point_t.h>
#include <cbag/common/transformation.h>
#include <cbag/gdsii/typedefs.h>
#include <cbag/layout/polygons.h>
Expand Down Expand Up @@ -93,8 +94,11 @@ void write_transform(spdlog::logger &logger, std::ostream &stream, const transfo
void write_polygon(spdlog::logger &logger, std::ostream &stream, glay_t layer, gpurp_t purpose,
const layout::poly_t &poly, int scale, const std::string *prop_ptr = nullptr);

void write_path(spdlog::logger &logger, std::ostream &stream, glay_t layer, gpurp_t purpose, enum_t path_type,
offset_t width, offset_t begin_extn, offset_t end_extn, const std::vector<point_t> &pt_vec, int scale);

void write_box(spdlog::logger &logger, std::ostream &stream, glay_t layer, gpurp_t purpose,
const box_t &box, int scale);
const box_t &box, int scale, const std::string *prop_ptr = nullptr);

void write_instance(spdlog::logger &logger, std::ostream &stream, const std::string &cell_name,
const std::string &inst_name, const transformation &xform, int scale,
Expand Down
2 changes: 1 addition & 1 deletion include/cbag/layout/blockage.h
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ namespace layout {
class blockage : public poly_t {
private:
blockage_type type;
lay_t layer;
lay_t layer_blk;

public:
explicit blockage(blockage_type type = blockage_type::routing, lay_t layer = 0) noexcept;
Expand Down
1 change: 1 addition & 0 deletions include/cbag/layout/cellview.h
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ limitations under the License.
#include <cbag/layout/boundary.h>
#include <cbag/layout/cellview_fwd.h>
#include <cbag/layout/label.h>
#include <cbag/layout/path.h>
#include <cbag/layout/pin.h>
#include <cbag/layout/tech.h>
#include <cbag/layout/via.h>
Expand Down
11 changes: 11 additions & 0 deletions include/cbag/layout/cellview_fwd.h
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ namespace layout {

class boundary;
class blockage;
class path;
class pin;
class via;
class via_wrapper;
Expand All @@ -80,6 +81,8 @@ class track_id;
using geo_index_t = polygon::index::geo_index<coord_t>;

using geo_map_t = util::sorted_map<layer_t, poly_set_t>;
using neg_geo_map_t = util::sorted_map<layer_t, std::vector<poly_t>>;
using path_map_t = util::sorted_map<layer_t, std::vector<path>>;
using block_map_t = util::sorted_map<lay_t, std::vector<blockage>>;
using pin_map_t = util::sorted_map<lay_t, std::vector<pin>>;
using inst_map_t = util::sorted_map<std::string, instance>;
Expand All @@ -92,6 +95,8 @@ class cellview {
std::string cell_name;
std::vector<std::shared_ptr<geo_index_t>> index_list;
geo_map_t geo_map;
neg_geo_map_t neg_geo_map;
path_map_t path_map;
inst_map_t inst_map;
pin_map_t pin_map;
std::vector<via> via_list;
Expand Down Expand Up @@ -122,6 +127,10 @@ class cellview {
auto end_inst() const -> decltype(inst_map.cend());
auto begin_geometry() const -> decltype(geo_map.cbegin());
auto end_geometry() const -> decltype(geo_map.cend());
auto begin_neg_geometry() const -> decltype(neg_geo_map.cbegin());
auto end_neg_geometry() const -> decltype(neg_geo_map.cend());
auto begin_path() const -> decltype(path_map.cbegin());
auto end_path() const -> decltype(path_map.cend());
auto begin_via() const -> decltype(via_list.cbegin());
auto end_via() const -> decltype(via_list.cend());
auto begin_lay_block() const -> decltype(lay_block_map.cbegin());
Expand All @@ -141,6 +150,7 @@ class cellview {

void add_label(layer_t &&key, transformation &&xform, std::string &&label, offset_t height);

void add_object(const path &obj);
void add_object(const blockage &obj);
void add_object(const boundary &obj);
void add_object(boundary &&obj);
Expand All @@ -152,6 +162,7 @@ class cellview {
void add_shape(layer_t key, const poly_90_t &obj);
void add_shape(layer_t key, const poly_45_t &obj);
void add_shape(layer_t key, const poly_t &obj);
void add_neg_shape(layer_t key, const poly_t &obj);
void add_shape(layer_t key, const poly_set_t &obj);
void add_warr(const track_id &tid, coord_t lower, coord_t upper, bool is_dummy = false);
void do_max_space_fill(level_t level, const box_t &bbox, bool fill_boundaries,
Expand Down
5 changes: 4 additions & 1 deletion include/cbag/layout/lp_lookup.h
Original file line number Diff line number Diff line change
Expand Up @@ -63,18 +63,21 @@ class lp_lookup {
purp_map_t purp_map_;
purp_t default_purpose_;
purp_t pin_purpose_;
purp_t label_purpose_;

public:
// default constructor needed to make tech default constructable
lp_lookup();

lp_lookup(lay_map_t &&lay_map, purp_map_t &&purp_map, const std::string &def_purp,
const std::string &pin_purp);
const std::string &pin_purp, const std::string &label_purp);

purp_t get_default_purpose() const;

purp_t get_pin_purpose() const;

purp_t get_label_purpose() const;

const std::string &get_layer_name(lay_t lay_id) const;

const std::string &get_purpose_name(purp_t purp_id) const;
Expand Down
39 changes: 39 additions & 0 deletions include/cbag/layout/path.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
#ifndef CBAG_LAYOUT_PATH_H
#define CBAG_LAYOUT_PATH_H

#include <vector>

#include <cbag/common/typedefs.h>
#include <cbag/common/layer_t.h>
#include <cbag/common/point_t.h>

namespace cbag {
namespace layout {

class path {
private:
layer_t lay_purp;
enum_t path_type;
offset_t width;
offset_t begin_extn;
offset_t end_extn;
std::vector<point_t> pt_vec;

public:
explicit path(layer_t lay_purp, offset_t width, std::vector<point_t> pt_vec,
enum_t path_type = 0, offset_t begin_extn = 0, offset_t end_extn = 0) noexcept;

layer_t get_layer_t() const;
enum_t get_path_type() const;
offset_t get_width() const noexcept;
offset_t get_begin_extn() const noexcept;
offset_t get_end_extn() const noexcept;
std::vector<point_t> get_pt_vec() const;

bool operator==(const path &rhs) const noexcept;
};

} // namespace layout
} // namespace cbag

#endif
2 changes: 2 additions & 0 deletions include/cbag/layout/tech.h
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ class tech {

purp_t get_pin_purpose() const;

purp_t get_label_purpose() const;

bool exclude_is_blockage() const;

const color_map_t &get_color_map() const;
Expand Down
2 changes: 2 additions & 0 deletions include/cbag/layout/tech_util.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,8 @@ layer_t get_test_lay_purp(const tech &t, level_t level);
layer_t get_layer_t(const tech &t, const track_coloring &tr_colors, level_t level, htr_t htr,
bool is_dummy = false);

const std::string &get_label_purpose_name(const tech &t);

const std::string &get_pin_purpose_name(const tech &t);

const std::string &get_default_purpose_name(const tech &t);
Expand Down
3 changes: 2 additions & 1 deletion include/cbag/layout/via_info.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,12 +79,13 @@ class via_info {
std::vector<vector> sp2_list_;
std::vector<vector> sp3_list_;
std::array<venc_info, 2> enc_list_;
int priority_;

public:
via_info();

via_info(std::string &&name, vector &&cdim, vector &&s, std::vector<vector> &&s2_list,
std::vector<vector> &&s3_list, std::array<venc_info, 2> &&e_list);
std::vector<vector> &&s3_list, std::array<venc_info, 2> &&e_list, int &&priority);

const std::string &get_name() const noexcept;

Expand Down
3 changes: 2 additions & 1 deletion include/cbag/layout/via_param.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,13 @@ struct via_param {
vector cut_spacing = {0, 0};
std::array<vector, 2> enc = {vector{0, 0}, vector{0, 0}};
std::array<vector, 2> off = {vector{0, 0}, vector{0, 0}};
int priority_ = 1;

via_param();

via_param(cnt_t vnx, cnt_t vny, offset_t w, offset_t h, offset_t vspx, offset_t vspy,
offset_t enc1l, offset_t enc1r, offset_t enc1t, offset_t enc1b, offset_t enc2l,
offset_t enc2r, offset_t enc2t, offset_t enc2b);
offset_t enc2r, offset_t enc2t, offset_t enc2b, int priority);

bool operator==(const via_param &rhs) const noexcept;

Expand Down
2 changes: 1 addition & 1 deletion include/cbag/netlist/core.h
Original file line number Diff line number Diff line change
Expand Up @@ -125,9 +125,9 @@ void write_cv_content(Stream &stream, const sch::cellview_info &info,
auto inst_ast = cbag::util::parse_cdba_name_unit(inst_name);
auto n = inst_ast.size();
auto term_net_vec = term_net_vec_t();
split_array_inst_nets(term_net_vec, inst_name, n, inst->connections, cv_info.in_terms);
split_array_inst_nets(term_net_vec, inst_name, n, inst->connections, cv_info.out_terms);
split_array_inst_nets(term_net_vec, inst_name, n, inst->connections, cv_info.io_terms);
split_array_inst_nets(term_net_vec, inst_name, n, inst->connections, cv_info.in_terms);

for (decltype(n) inst_idx = 0; inst_idx < n; ++inst_idx) {
if (flat && cv_info.cv_ptr) {
Expand Down
3 changes: 3 additions & 0 deletions include/cbag/netlist/lstream.h
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ class lstream {

nstream_output &to_file(nstream_output &stream, spirit::namespace_spectre,
bool newline = true) const;

nstream_output &to_file(nstream_output &stream, spirit::namespace_ngspice,
bool newline = true) const;
};

} // namespace netlist
Expand Down
Loading