aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ice40/chip.cc40
-rw-r--r--ice40/main.cc34
2 files changed, 61 insertions, 13 deletions
diff --git a/ice40/chip.cc b/ice40/chip.cc
index b349cf12..d1226b3a 100644
--- a/ice40/chip.cc
+++ b/ice40/chip.cc
@@ -401,14 +401,38 @@ vector<GraphicElement> Chip::getBelGraphics(BelId bel) const
}
if (bel_type == TYPE_SB_IO) {
- GraphicElement el;
- el.type = GraphicElement::G_BOX;
- el.x1 = chip_info.bel_data[bel.index].x + 0.1;
- el.x2 = chip_info.bel_data[bel.index].x + 0.9;
- el.y1 = chip_info.bel_data[bel.index].y + 0.10 + (chip_info.bel_data[bel.index].z) * (0.8/2);
- el.y2 = chip_info.bel_data[bel.index].y + 0.40 + (chip_info.bel_data[bel.index].z) * (0.8/2);
- el.z = 0;
- ret.push_back(el);
+ if (chip_info.bel_data[bel.index].x == 0 || chip_info.bel_data[bel.index].x == chip_info.width-1)
+ {
+ GraphicElement el;
+ el.type = GraphicElement::G_BOX;
+ el.x1 = chip_info.bel_data[bel.index].x + 0.1;
+ el.x2 = chip_info.bel_data[bel.index].x + 0.9;
+ if (chip_info.bel_data[bel.index].z == 0) {
+ el.y1 = chip_info.bel_data[bel.index].y + 0.10;
+ el.y2 = chip_info.bel_data[bel.index].y + 0.45;
+ } else {
+ el.y1 = chip_info.bel_data[bel.index].y + 0.55;
+ el.y2 = chip_info.bel_data[bel.index].y + 0.90;
+ }
+ el.z = 0;
+ ret.push_back(el);
+ }
+ else
+ {
+ GraphicElement el;
+ el.type = GraphicElement::G_BOX;
+ if (chip_info.bel_data[bel.index].z == 0) {
+ el.x1 = chip_info.bel_data[bel.index].x + 0.10;
+ el.x2 = chip_info.bel_data[bel.index].x + 0.45;
+ } else {
+ el.x1 = chip_info.bel_data[bel.index].x + 0.55;
+ el.x2 = chip_info.bel_data[bel.index].x + 0.90;
+ }
+ el.y1 = chip_info.bel_data[bel.index].y + 0.1;
+ el.y2 = chip_info.bel_data[bel.index].y + 0.9;
+ el.z = 0;
+ ret.push_back(el);
+ }
}
if (bel_type == TYPE_ICESTORM_RAM) {
diff --git a/ice40/main.cc b/ice40/main.cc
index a32aa2db..185c7f53 100644
--- a/ice40/main.cc
+++ b/ice40/main.cc
@@ -26,17 +26,17 @@
void svg_dump_el(const GraphicElement &el)
{
- float scale = 10.0;
+ float scale = 10.0, offset = 10.0;
std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\"";
if (el.type == GraphicElement::G_BOX) {
- std::cout << "<rect x=\"" << (scale*el.x1) << "\" y=\"" << (scale*el.y1) <<
+ std::cout << "<rect x=\"" << (offset + scale*el.x1) << "\" y=\"" << (offset + scale*el.y1) <<
"\" height=\"" << (scale*(el.y2-el.y1)) << "\" width=\"" << (scale*(el.x2-el.x1)) << "\" " << style << "/>\n";
}
if (el.type == GraphicElement::G_LINE) {
- std::cout << "<line x1=\"" << (scale*el.x1) << "\" y1=\"" << (scale*el.y1) <<
- "\" x2=\"" << (scale*el.x2) << "\" y2=\"" << (scale*el.y2) << "\" " << style << "/>\n";
+ std::cout << "<line x1=\"" << (offset + scale*el.x1) << "\" y1=\"" << (offset + scale*el.y1) <<
+ "\" x2=\"" << (offset + scale*el.x2) << "\" y2=\"" << (offset + scale*el.y2) << "\" " << style << "/>\n";
}
}
@@ -53,6 +53,12 @@ int main(int argc, char *argv[])
options.add_options()("svg","dump SVG file");
options.add_options()("file", po::value<std::string>(), "python file to execute");
options.add_options()("version,v","show version");
+ options.add_options()("lp384","set device type to iCE40LP384");
+ options.add_options()("lp1k","set device type to iCE40LP1K");
+ options.add_options()("lp8k","set device type to iCE40LP8K");
+ options.add_options()("hx1k","set device type to iCE40HX1K");
+ options.add_options()("hx8k","set device type to iCE40HX8K");
+ options.add_options()("up5k","set device type to iCE40UP5K");
po::positional_options_description pos;
pos.add("file", -1);
@@ -89,7 +95,25 @@ int main(int argc, char *argv[])
}
ChipArgs chipArgs;
- chipArgs.type = ChipArgs::LP384;
+ chipArgs.type = ChipArgs::HX1K;
+
+ if (vm.count("lp384"))
+ chipArgs.type = ChipArgs::LP384;
+
+ if (vm.count("lp1k"))
+ chipArgs.type = ChipArgs::LP1K;
+
+ if (vm.count("lp8k"))
+ chipArgs.type = ChipArgs::LP8K;
+
+ if (vm.count("hx1k"))
+ chipArgs.type = ChipArgs::HX1K;
+
+ if (vm.count("hx8k"))
+ chipArgs.type = ChipArgs::HX8K;
+
+ if (vm.count("up5k"))
+ chipArgs.type = ChipArgs::UP5K;
Design design(chipArgs);