From 5b2100a5dff759eafd65d19c30b10a46043f7b2c Mon Sep 17 00:00:00 2001 From: Miodrag Milanovic Date: Tue, 19 Mar 2024 13:41:24 +0100 Subject: [PATCH] extend API so we can distinguish CLK wires --- himbaechel/arch.cc | 2 +- himbaechel/himbaechel_api.h | 2 +- himbaechel/uarch/example/constids.inc | 5 +++++ himbaechel/uarch/example/example.cc | 23 ++++++++++++++++++++++- 4 files changed, 29 insertions(+), 3 deletions(-) diff --git a/himbaechel/arch.cc b/himbaechel/arch.cc index 2f588e85..10a4663d 100644 --- a/himbaechel/arch.cc +++ b/himbaechel/arch.cc @@ -515,7 +515,7 @@ std::vector Arch::getDecalGraphics(DecalId decal) const Loc loc; tile_xy(chip_info, wire.tile, loc.x, loc.y); int32_t tilewire = chip_wire_info(chip_info, wire).tile_wire; - uarch->drawWire(ret, style, loc, wire_type, tilewire); + uarch->drawWire(ret, style, loc, wire_type, tilewire, get_tile_type(wire.tile)); } else if (decal.type == DecalId::TYPE_PIP) { PipId pip(decal.tile, decal.index); WireId src_wire = getPipSrcWire(pip); diff --git a/himbaechel/himbaechel_api.h b/himbaechel/himbaechel_api.h index d8b9c6fd..0ae7d241 100644 --- a/himbaechel/himbaechel_api.h +++ b/himbaechel/himbaechel_api.h @@ -116,7 +116,7 @@ struct HimbaechelAPI // Graphics virtual void drawBel(std::vector &g, GraphicElement::style_t style, IdString bel_type, Loc loc) {}; - virtual void drawWire(std::vector &g, GraphicElement::style_t style, Loc loc, IdString wire_type, int32_t tilewire) {}; + virtual void drawWire(std::vector &g, GraphicElement::style_t style, Loc loc, IdString wire_type, int32_t tilewire, IdString tile_type) {}; virtual void drawPip(std::vector &g,GraphicElement::style_t style, Loc loc, WireId src, IdString src_type, int32_t src_id, WireId dst, IdString dst_type, int32_t dst_id) {}; diff --git a/himbaechel/uarch/example/constids.inc b/himbaechel/uarch/example/constids.inc index a8cedb34..29f7c3f7 100644 --- a/himbaechel/uarch/example/constids.inc +++ b/himbaechel/uarch/example/constids.inc @@ -24,3 +24,8 @@ X(LUT_INPUT) X(FF_DATA) X(LUT_OUT) X(FF_OUT) +X(TILE_CLK) + +X(LOGIC) +X(BRAM) +X(IO) diff --git a/himbaechel/uarch/example/example.cc b/himbaechel/uarch/example/example.cc index 56fece31..7174a31c 100644 --- a/himbaechel/uarch/example/example.cc +++ b/himbaechel/uarch/example/example.cc @@ -177,7 +177,7 @@ struct ExampleImpl : HimbaechelAPI } } - void drawWire(std::vector &g, GraphicElement::style_t style, Loc loc, IdString wire_type, int32_t tilewire) + void drawWire(std::vector &g, GraphicElement::style_t style, Loc loc, IdString wire_type, int32_t tilewire, IdString tile_type) { GraphicElement el; el.type = GraphicElement::TYPE_LINE; @@ -217,6 +217,27 @@ struct ExampleImpl : HimbaechelAPI el.y2 = el.y1; g.push_back(el); break; + case id_TILE_CLK.index: + switch(tile_type.index) + { + case id_LOGIC.index: + for(int i=0;i<8; i++) { + GraphicElement el; + el.type = GraphicElement::TYPE_LINE; + el.style = style; + el.x1 = loc.x + 0.6; + el.x2 = el.x1; + el.y1 = loc.y + 0.85 - i * 0.1 - 0.05; + el.y2 = el.y1 - 0.05; + g.push_back(el); + } + break; + case id_BRAM.index: + break; + case id_IO.index: + break; + } + break; } }