Add iCE40 device selection, improve iCE40 IO GraphicElements

Signed-off-by: Clifford Wolf <clifford@clifford.at>
This commit is contained in:
Clifford Wolf 2018-06-06 17:23:58 +02:00
parent afbae1bb99
commit f9bd66e7ac
2 changed files with 61 additions and 13 deletions

View File

@ -401,15 +401,39 @@ vector<GraphicElement> Chip::getBelGraphics(BelId bel) const
} }
if (bel_type == TYPE_SB_IO) { if (bel_type == TYPE_SB_IO) {
if (chip_info.bel_data[bel.index].x == 0 || chip_info.bel_data[bel.index].x == chip_info.width-1)
{
GraphicElement el; GraphicElement el;
el.type = GraphicElement::G_BOX; el.type = GraphicElement::G_BOX;
el.x1 = chip_info.bel_data[bel.index].x + 0.1; el.x1 = chip_info.bel_data[bel.index].x + 0.1;
el.x2 = chip_info.bel_data[bel.index].x + 0.9; 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); if (chip_info.bel_data[bel.index].z == 0) {
el.y2 = chip_info.bel_data[bel.index].y + 0.40 + (chip_info.bel_data[bel.index].z) * (0.8/2); 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; el.z = 0;
ret.push_back(el); 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) { if (bel_type == TYPE_ICESTORM_RAM) {
GraphicElement el; GraphicElement el;

View File

@ -26,17 +26,17 @@
void svg_dump_el(const GraphicElement &el) 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\""; std::string style = "stroke=\"black\" stroke-width=\"0.1\" fill=\"none\"";
if (el.type == GraphicElement::G_BOX) { 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"; "\" height=\"" << (scale*(el.y2-el.y1)) << "\" width=\"" << (scale*(el.x2-el.x1)) << "\" " << style << "/>\n";
} }
if (el.type == GraphicElement::G_LINE) { if (el.type == GraphicElement::G_LINE) {
std::cout << "<line x1=\"" << (scale*el.x1) << "\" y1=\"" << (scale*el.y1) << std::cout << "<line x1=\"" << (offset + scale*el.x1) << "\" y1=\"" << (offset + scale*el.y1) <<
"\" x2=\"" << (scale*el.x2) << "\" y2=\"" << (scale*el.y2) << "\" " << style << "/>\n"; "\" 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()("svg","dump SVG file");
options.add_options()("file", po::value<std::string>(), "python file to execute"); options.add_options()("file", po::value<std::string>(), "python file to execute");
options.add_options()("version,v","show version"); 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; po::positional_options_description pos;
pos.add("file", -1); pos.add("file", -1);
@ -89,8 +95,26 @@ int main(int argc, char *argv[])
} }
ChipArgs chipArgs; ChipArgs chipArgs;
chipArgs.type = ChipArgs::HX1K;
if (vm.count("lp384"))
chipArgs.type = ChipArgs::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); Design design(chipArgs);
if (vm.count("gui")) if (vm.count("gui"))