diff options
Diffstat (limited to 'ecp5/arch.cc')
-rw-r--r-- | ecp5/arch.cc | 271 |
1 files changed, 3 insertions, 268 deletions
diff --git a/ecp5/arch.cc b/ecp5/arch.cc index 9e5c4a14..e6b43d0b 100644 --- a/ecp5/arch.cc +++ b/ecp5/arch.cc @@ -597,28 +597,6 @@ bool Arch::route() // ----------------------------------------------------------------------- -const float switchbox_x1 = 0.51; -const float switchbox_x2 = 0.90; -const float switchbox_y1 = 0.51; -const float switchbox_y2 = 0.90; - -const float slice_x1 = 0.92; -const float slice_x2 = 0.94; -const float slice_y1 = 0.71; -const float slice_y2 = 0.745 + 0.0068; -const float slice_pitch = 0.0374 +0.0068; - -const float io_cell_v_x1 = 0.76; -const float io_cell_v_x2 = 0.95; -const float io_cell_v_y1 = 0.05; -const float io_cell_v_y2 = 0.15; -const float io_cell_v_pitch = 0.125; - -const float io_cell_h_x1 = 0.05; -const float io_cell_h_x2 = 0.14; -const float io_cell_h_y1 = 0.05; -const float io_cell_h_y2 = 0.24; -const float io_cell_h_pitch = 0.125; std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const { @@ -648,254 +626,11 @@ std::vector<GraphicElement> Arch::getDecalGraphics(DecalId decal) const auto wire_type = getWireType(wire); int x = decal.location.x; int y = chip_info->height - 1 - decal.location.y; + GraphicElement::style_t style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; GfxTileWireId tilewire = GfxTileWireId(locInfo(wire)->wire_data[wire.index].tile_wire); - if (wire_type == id_WIRE_TYPE_SLICE && tilewire != GfxTileWireId::TILE_WIRE_NONE) { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - if (tilewire >= TILE_WIRE_FCO_SLICE && tilewire <=TILE_WIRE_FCI_SLICE) - { - int gap = (tilewire - TILE_WIRE_FCO_SLICE) / 24; - int item = (tilewire - TILE_WIRE_FCO_SLICE) % 24; - el.x1 = x + slice_x1 - 0.005f; - el.x2 = x + slice_x1; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap*2) + 3*slice_pitch; - el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO_SLICE + 1 + gap*2) + 3*slice_pitch; - ret.push_back(el); - // FX to F connection - top - if (item == (TILE_WIRE_FXD_SLICE-TILE_WIRE_FCO_SLICE)) - { - el.x2 = el.x1; - el.y2 = el.y1 - 0.0017f; - ret.push_back(el); - } - // F5 to F connection - bottom - if (item == (TILE_WIRE_F5D_SLICE-TILE_WIRE_FCO_SLICE)) - { - el.x2 = el.x1; - el.y2 = el.y1 + 0.0017f; - ret.push_back(el); - } - // connection between slices - if (item == (TILE_WIRE_FCID_SLICE-TILE_WIRE_FCO_SLICE) && tilewire!=TILE_WIRE_FCI_SLICE) - { - el.x2 = el.x1; - el.y2 = el.y1 - 0.0017f * 3; - ret.push_back(el); - } - } - if (tilewire >= TILE_WIRE_DUMMY_D2 && tilewire <=TILE_WIRE_WAD0A_SLICE) - { - int gap = (tilewire - TILE_WIRE_DUMMY_D2) / 12; - el.x1 = x + slice_x2 + 0.005f; - el.x2 = x + slice_x2; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap*14) + 3*slice_pitch; - el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_DUMMY_D2 + 1 + gap*14) + 3*slice_pitch; - ret.push_back(el); - } - } - if (wire_type == id_WIRE_TYPE_V01) { - if (tilewire >= TILE_WIRE_V01N0001 && tilewire <=TILE_WIRE_V01S0100) - { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + switchbox_x2 - 0.0017f*16 + 0.0017f * (tilewire - TILE_WIRE_V01N0001); - el.x2 = el.x1; - el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y2 - 1; - ret.push_back(el); - } - } - if (wire_type == id_WIRE_TYPE_H01) { - if (tilewire >= TILE_WIRE_H01E0001 && tilewire <=TILE_WIRE_HL7W0001) - { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + switchbox_x1; - el.x2 = x + switchbox_x2 - 1; - el.y1 = y + switchbox_y1 + 0.0017f*16 - 0.0017f * (tilewire - TILE_WIRE_H01E0001); - el.y2 = el.y1; - ret.push_back(el); - } - } - if (wire_type == id_WIRE_TYPE_V00) { - int group = (tilewire - TILE_WIRE_V00T0000) / 2; - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + switchbox_x2 - 0.0017f*(8 - ((tilewire - TILE_WIRE_V00T0000) % 2)*4); - el.x2 = el.x1; - if (group) { - el.y1 = y + switchbox_y1; - el.y2 = y + switchbox_y1 - 0.0017f*4; - } else { - el.y1 = y + switchbox_y2; - el.y2 = y + switchbox_y2 + 0.0017f*4; - } - ret.push_back(el); - } - if (wire_type == id_WIRE_TYPE_H00) { - int group = (tilewire - TILE_WIRE_H00L0000) / 2; - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.y1 = y + switchbox_y1 + 0.0017f*(8 - ((tilewire - TILE_WIRE_H00L0000) % 2)*4); - el.y2 = el.y1; - - if (group) { - el.x1 = x + switchbox_x2 + 0.0017f*4; - el.x2 = x + switchbox_x2; - } else { - el.x1 = x + switchbox_x1 - 0.0017f*4; - el.x2 = x + switchbox_x1; - } - ret.push_back(el); - } - if (wire_type == id_WIRE_TYPE_NONE) { - if (tilewire >= TILE_WIRE_NBOUNCE && tilewire <=TILE_WIRE_SBOUNCE) - { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + switchbox_x2 - 0.0017f*4; - el.x2 = x + switchbox_x2 - 0.0017f*8; - if (tilewire == TILE_WIRE_NBOUNCE) { - el.y1 = y + switchbox_y2 + 0.0017f*4; - el.y2 = el.y1; - } else { - el.y1 = y + switchbox_y1 - 0.0017f*4; - el.y2 = el.y1; - } - ret.push_back(el); - } - if (tilewire >= TILE_WIRE_WBOUNCE && tilewire <=TILE_WIRE_EBOUNCE) - { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.y1 = y + switchbox_y1 + 0.0017f*4; - el.y2 = y + switchbox_y1 + 0.0017f*8; - if (tilewire == TILE_WIRE_WBOUNCE) { - el.x1 = x + switchbox_x1 - 0.0017f*4; - el.x2 = el.x1; - } else { - el.x1 = x + switchbox_x2 + 0.0017f*4; - el.x2 = el.x1; - } - ret.push_back(el); - } - if (tilewire >= TILE_WIRE_CLK0 && tilewire <=TILE_WIRE_LSR1) - { - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + switchbox_x2; - el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_CLK0 - 5) + 3*slice_pitch; - el.y2 = el.y1; - ret.push_back(el); - el.x1 = el.x2; - el.y2 = y + slice_y2 - 0.0017f * (3 + (tilewire - TILE_WIRE_CLK0)); - ret.push_back(el); - for (int i=0;i<4;i++) - { - el.x1 = x + slice_x2 + 0.0255f + 0.0017f; - el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f; - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + tilewire - TILE_WIRE_CLK0)+ i*slice_pitch; - el.y2 = el.y1; - ret.push_back(el); - } - if (tilewire==TILE_WIRE_CLK1 || tilewire==TILE_WIRE_LSR1) { - for (int i=0;i<2;i++) - { - el.x1 = x + slice_x2 + 0.0051f; - el.x2 = x + slice_x2 + 0.0255f + (8 - (tilewire - TILE_WIRE_CLK0)) * 0.0017f; - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 - 1 + (tilewire - TILE_WIRE_CLK0)/2)+ i*slice_pitch; - el.y2 = el.y1; - ret.push_back(el); - } - } - } - - if (tilewire >= TILE_WIRE_FCO && tilewire <=TILE_WIRE_FCI) - { - int gap = (tilewire - TILE_WIRE_FCO) / 24; - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + switchbox_x2; - el.x2 = x + slice_x1 - 0.005f; - el.y1 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch; - el.y2 = y + slice_y2 - 0.0017f * (tilewire - TILE_WIRE_FCO + 1 + gap*2) + 3*slice_pitch; - ret.push_back(el); - } - - if (tilewire >= TILE_WIRE_MUXCLK3 && tilewire <=TILE_WIRE_MUXLSR0) - { - int gap = (tilewire - TILE_WIRE_MUXCLK3) / 2; - int part = (tilewire - TILE_WIRE_MUXCLK3) % 2; - GraphicElement el; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + slice_x2 + 0.0051f; - el.x2 = x + slice_x2 + 0.0255f; - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_CLK3_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + gap*26) + 3*slice_pitch; - el.y2 = el.y1; - ret.push_back(el); - } - - if (tilewire >= TILE_WIRE_WD3 && tilewire <=TILE_WIRE_WD0) - { - GraphicElement el; - int part = (tilewire - TILE_WIRE_WD3) % 4; - int group = (tilewire - TILE_WIRE_WD3) / 2; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + slice_x2 + 0.005f; - el.x2 = x + slice_x2 + 0.005f + 0.0017f *(4 - part); - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_WDO3C_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part + 14) + 3*slice_pitch; - el.y2 = el.y1; - ret.push_back(el); - - el.x1 = el.x2; - el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WD1B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + (part & 1) + 14*2) + (3-group)*slice_pitch; - ret.push_back(el); - - el.x1 = x + slice_x2 + 0.005f; - el.y1 = el.y2; - ret.push_back(el); - } - if (tilewire >= TILE_WIRE_WAD3 && tilewire <=TILE_WIRE_WAD0) - { - GraphicElement el; - int part = (tilewire - TILE_WIRE_WAD3) % 4; - el.type = GraphicElement::TYPE_LINE; - el.style = decal.active ? GraphicElement::STYLE_ACTIVE : GraphicElement::STYLE_INACTIVE; - el.x1 = x + slice_x2 + 0.005f; - el.x2 = x + slice_x2 + 0.005f + 0.0017f *(8 - part); - el.y1 = y + slice_y2 - 0.0017f * (TILE_WIRE_WADO3C_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14) + 3*slice_pitch; - el.y2 = el.y1; - ret.push_back(el); - - el.x1 = el.x2; - el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14*2) + 2*slice_pitch; - ret.push_back(el); - - el.x1 = x + slice_x2 + 0.005f; - el.y1 = el.y2; - ret.push_back(el); - - // middle line - el.x1 = x + slice_x2 + 0.005f; - el.x2 = x + slice_x2 + 0.005f + 0.0017f *(8 - part); - el.y2 = y + slice_y2 - 0.0017f * (TILE_WIRE_WAD3B_SLICE - TILE_WIRE_DUMMY_D2 + 1 + part+ 14*2) + 3*slice_pitch; - el.y1 = el.y2; - ret.push_back(el); - } - } + + gfxTileWire(ret, x, y, wire_type, tilewire, style); } if (decal.type == DecalId::TYPE_BEL) { BelId bel; |