diff --git a/src/hook/render/layout.js b/src/hook/render/layout.js
index a4133fb..0ad4c34 100644
--- a/src/hook/render/layout.js
+++ b/src/hook/render/layout.js
@@ -5,14 +5,20 @@
import { CELL_LIBS, ModuleTree } from "./yosys";
export const LAYOUT_CONSTANT = {
+ // port
PORT_WIDTH: 50,
PORT_HEIGHT: 20,
+
+ // 例化模块(这只是最小,height 会根据端口数量进行调整)
INSTANTIATION_WIDTH: 50,
INSTANTIATION_HEIGHT: 50,
+
+ // 常数
CONSTANT_WIDTH: 50,
CONSTANT_HEIGHT: 50,
- CELL_PORT_HEIGHT: 10,
+ // 器件的端口
+ CELL_PORT_HEIGHT: 5,
CELL_PORT_WIDTH: 5
};
@@ -77,8 +83,8 @@ export class Module {
type: port.direction,
width: LAYOUT_CONSTANT.PORT_WIDTH,
height: LAYOUT_CONSTANT.PORT_HEIGHT,
- properties: {
- 'elk.layered.nodePlacement.side': direction
+ layoutOptions: {
+ 'elk.side': direction
}
};
@@ -181,7 +187,7 @@ export class Module {
// 创建常数到器件的连线
const edge = {
id: makeEdgeId(cellId, id),
- sources: [cellId],
+ sources: [connection.id],
targets: [id]
};
@@ -192,13 +198,24 @@ export class Module {
// 2. 当前的器件的这个端口和另一个器件的一个端口连接
if (tree.wireIdToPort.has(wireId)) {
const port = tree.wireIdToPort.get(wireId);
- const edge = {
- id: makeEdgeId(cellId, port.id),
- sources: [cellId],
- targets: [port.id]
- };
- edges.push(edge);
+ if (port.direction === 'input') {
+ const edge = {
+ id: makeEdgeId(cellId, port.id),
+ sources: [port.id],
+ targets: [connection.id]
+ };
+
+ edges.push(edge);
+ } else {
+ const edge = {
+ id: makeEdgeId(cellId, port.id),
+ sources: [connection.id],
+ targets: [port.id]
+ };
+
+ edges.push(edge);
+ }
} else if (tree.wireIdToConnection.has(wireId)) {
const connection = tree.wireIdToConnection.get(wireId);
const edge = {
diff --git a/src/static/Word/Binary operators/add.svg b/src/static/Word/Binary operators/add.svg
new file mode 100644
index 0000000..b74a91f
--- /dev/null
+++ b/src/static/Word/Binary operators/add.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/and.svg b/src/static/Word/Binary operators/and.svg
new file mode 100644
index 0000000..15585f5
--- /dev/null
+++ b/src/static/Word/Binary operators/and.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/div.svg b/src/static/Word/Binary operators/div.svg
new file mode 100644
index 0000000..5dcd876
--- /dev/null
+++ b/src/static/Word/Binary operators/div.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/eq.svg b/src/static/Word/Binary operators/eq.svg
new file mode 100644
index 0000000..05bc973
--- /dev/null
+++ b/src/static/Word/Binary operators/eq.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/eqx.svg b/src/static/Word/Binary operators/eqx.svg
new file mode 100644
index 0000000..e085dae
--- /dev/null
+++ b/src/static/Word/Binary operators/eqx.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/ge.svg b/src/static/Word/Binary operators/ge.svg
new file mode 100644
index 0000000..1578981
--- /dev/null
+++ b/src/static/Word/Binary operators/ge.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/gt.svg b/src/static/Word/Binary operators/gt.svg
new file mode 100644
index 0000000..7ef4a3c
--- /dev/null
+++ b/src/static/Word/Binary operators/gt.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/le.svg b/src/static/Word/Binary operators/le.svg
new file mode 100644
index 0000000..1a48f11
--- /dev/null
+++ b/src/static/Word/Binary operators/le.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/logic_and.svg b/src/static/Word/Binary operators/logic_and.svg
new file mode 100644
index 0000000..a62b3a6
--- /dev/null
+++ b/src/static/Word/Binary operators/logic_and.svg
@@ -0,0 +1,44 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/logic_or.svg b/src/static/Word/Binary operators/logic_or.svg
new file mode 100644
index 0000000..c65c233
--- /dev/null
+++ b/src/static/Word/Binary operators/logic_or.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/lt.svg b/src/static/Word/Binary operators/lt.svg
new file mode 100644
index 0000000..8ca2600
--- /dev/null
+++ b/src/static/Word/Binary operators/lt.svg
@@ -0,0 +1,26 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/mod.svg b/src/static/Word/Binary operators/mod.svg
new file mode 100644
index 0000000..76466b7
--- /dev/null
+++ b/src/static/Word/Binary operators/mod.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/mul.svg b/src/static/Word/Binary operators/mul.svg
new file mode 100644
index 0000000..d9fa29f
--- /dev/null
+++ b/src/static/Word/Binary operators/mul.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/ne.svg b/src/static/Word/Binary operators/ne.svg
new file mode 100644
index 0000000..581501e
--- /dev/null
+++ b/src/static/Word/Binary operators/ne.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/nex.svg b/src/static/Word/Binary operators/nex.svg
new file mode 100644
index 0000000..441b0b7
--- /dev/null
+++ b/src/static/Word/Binary operators/nex.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/or.svg b/src/static/Word/Binary operators/or.svg
new file mode 100644
index 0000000..874876a
--- /dev/null
+++ b/src/static/Word/Binary operators/or.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/pow.svg b/src/static/Word/Binary operators/pow.svg
new file mode 100644
index 0000000..ac9af6f
--- /dev/null
+++ b/src/static/Word/Binary operators/pow.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/shl.svg b/src/static/Word/Binary operators/shl.svg
new file mode 100644
index 0000000..5c959ac
--- /dev/null
+++ b/src/static/Word/Binary operators/shl.svg
@@ -0,0 +1,28 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/shr.svg b/src/static/Word/Binary operators/shr.svg
new file mode 100644
index 0000000..9fc76bb
--- /dev/null
+++ b/src/static/Word/Binary operators/shr.svg
@@ -0,0 +1,28 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/sshl.svg b/src/static/Word/Binary operators/sshl.svg
new file mode 100644
index 0000000..61bb965
--- /dev/null
+++ b/src/static/Word/Binary operators/sshl.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/sshr.svg b/src/static/Word/Binary operators/sshr.svg
new file mode 100644
index 0000000..a3d901a
--- /dev/null
+++ b/src/static/Word/Binary operators/sshr.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/sub.svg b/src/static/Word/Binary operators/sub.svg
new file mode 100644
index 0000000..f45cd2c
--- /dev/null
+++ b/src/static/Word/Binary operators/sub.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/xnor.svg b/src/static/Word/Binary operators/xnor.svg
new file mode 100644
index 0000000..115df6e
--- /dev/null
+++ b/src/static/Word/Binary operators/xnor.svg
@@ -0,0 +1,14 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Binary operators/xor.svg b/src/static/Word/Binary operators/xor.svg
new file mode 100644
index 0000000..3088ab5
--- /dev/null
+++ b/src/static/Word/Binary operators/xor.svg
@@ -0,0 +1,16 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Coarse arithmetics/alu.svg b/src/static/Word/Coarse arithmetics/alu.svg
new file mode 100644
index 0000000..a151ff6
--- /dev/null
+++ b/src/static/Word/Coarse arithmetics/alu.svg
@@ -0,0 +1,43 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Coarse arithmetics/fa.svg b/src/static/Word/Coarse arithmetics/fa.svg
new file mode 100644
index 0000000..4615727
--- /dev/null
+++ b/src/static/Word/Coarse arithmetics/fa.svg
@@ -0,0 +1,37 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Finite state machines/fsm.svg b/src/static/Word/Finite state machines/fsm.svg
new file mode 100644
index 0000000..22553f8
--- /dev/null
+++ b/src/static/Word/Finite state machines/fsm.svg
@@ -0,0 +1,45 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Memories/mem.svg b/src/static/Word/Memories/mem.svg
new file mode 100644
index 0000000..150c9c1
--- /dev/null
+++ b/src/static/Word/Memories/mem.svg
@@ -0,0 +1,27 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Memories/mem_v2.svg b/src/static/Word/Memories/mem_v2.svg
new file mode 100644
index 0000000..e127855
--- /dev/null
+++ b/src/static/Word/Memories/mem_v2.svg
@@ -0,0 +1,49 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Memories/memrd.svg b/src/static/Word/Memories/memrd.svg
new file mode 100644
index 0000000..d2424c2
--- /dev/null
+++ b/src/static/Word/Memories/memrd.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Memories/memrd_v2.svg b/src/static/Word/Memories/memrd_v2.svg
new file mode 100644
index 0000000..5146bea
--- /dev/null
+++ b/src/static/Word/Memories/memrd_v2.svg
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Memories/memwr.svg b/src/static/Word/Memories/memwr.svg
new file mode 100644
index 0000000..3e38f68
--- /dev/null
+++ b/src/static/Word/Memories/memwr.svg
@@ -0,0 +1,19 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Memories/memwr_v2.svg b/src/static/Word/Memories/memwr_v2.svg
new file mode 100644
index 0000000..cb6f8e9
--- /dev/null
+++ b/src/static/Word/Memories/memwr_v2.svg
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Multiplexers/bmux.svg b/src/static/Word/Multiplexers/bmux.svg
new file mode 100644
index 0000000..3b31871
--- /dev/null
+++ b/src/static/Word/Multiplexers/bmux.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Multiplexers/bwmux.svg b/src/static/Word/Multiplexers/bwmux.svg
new file mode 100644
index 0000000..bba542c
--- /dev/null
+++ b/src/static/Word/Multiplexers/bwmux.svg
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Multiplexers/demux.svg b/src/static/Word/Multiplexers/demux.svg
new file mode 100644
index 0000000..3c6af9d
--- /dev/null
+++ b/src/static/Word/Multiplexers/demux.svg
@@ -0,0 +1,22 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Multiplexers/mux.svg b/src/static/Word/Multiplexers/mux.svg
new file mode 100644
index 0000000..43e15a8
--- /dev/null
+++ b/src/static/Word/Multiplexers/mux.svg
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Multiplexers/pmux.svg b/src/static/Word/Multiplexers/pmux.svg
new file mode 100644
index 0000000..7ab1889
--- /dev/null
+++ b/src/static/Word/Multiplexers/pmux.svg
@@ -0,0 +1,23 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Multiplexers/tribuf.svg b/src/static/Word/Multiplexers/tribuf.svg
new file mode 100644
index 0000000..e0388d5
--- /dev/null
+++ b/src/static/Word/Multiplexers/tribuf.svg
@@ -0,0 +1,14 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/adff.svg b/src/static/Word/Registers/adff.svg
new file mode 100644
index 0000000..d21e49c
--- /dev/null
+++ b/src/static/Word/Registers/adff.svg
@@ -0,0 +1,33 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/adffe.svg b/src/static/Word/Registers/adffe.svg
new file mode 100644
index 0000000..e709a10
--- /dev/null
+++ b/src/static/Word/Registers/adffe.svg
@@ -0,0 +1,35 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/adlatch.svg b/src/static/Word/Registers/adlatch.svg
new file mode 100644
index 0000000..f79dc6e
--- /dev/null
+++ b/src/static/Word/Registers/adlatch.svg
@@ -0,0 +1,28 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/aldff.svg b/src/static/Word/Registers/aldff.svg
new file mode 100644
index 0000000..a59442c
--- /dev/null
+++ b/src/static/Word/Registers/aldff.svg
@@ -0,0 +1,38 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/aldffe.svg b/src/static/Word/Registers/aldffe.svg
new file mode 100644
index 0000000..9614be9
--- /dev/null
+++ b/src/static/Word/Registers/aldffe.svg
@@ -0,0 +1,36 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/dff.svg b/src/static/Word/Registers/dff.svg
new file mode 100644
index 0000000..4a5f5b8
--- /dev/null
+++ b/src/static/Word/Registers/dff.svg
@@ -0,0 +1,30 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/dffe.svg b/src/static/Word/Registers/dffe.svg
new file mode 100644
index 0000000..677923e
--- /dev/null
+++ b/src/static/Word/Registers/dffe.svg
@@ -0,0 +1,32 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/dffsr.svg b/src/static/Word/Registers/dffsr.svg
new file mode 100644
index 0000000..e2409b3
--- /dev/null
+++ b/src/static/Word/Registers/dffsr.svg
@@ -0,0 +1,34 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/dffsre.svg b/src/static/Word/Registers/dffsre.svg
new file mode 100644
index 0000000..e824c54
--- /dev/null
+++ b/src/static/Word/Registers/dffsre.svg
@@ -0,0 +1,36 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/dlatch.svg b/src/static/Word/Registers/dlatch.svg
new file mode 100644
index 0000000..cc1518d
--- /dev/null
+++ b/src/static/Word/Registers/dlatch.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/dlatchsr.svg b/src/static/Word/Registers/dlatchsr.svg
new file mode 100644
index 0000000..ecda2df
--- /dev/null
+++ b/src/static/Word/Registers/dlatchsr.svg
@@ -0,0 +1,29 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/sdff.svg b/src/static/Word/Registers/sdff.svg
new file mode 100644
index 0000000..1ea0287
--- /dev/null
+++ b/src/static/Word/Registers/sdff.svg
@@ -0,0 +1,33 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/sdffce.svg b/src/static/Word/Registers/sdffce.svg
new file mode 100644
index 0000000..1616d67
--- /dev/null
+++ b/src/static/Word/Registers/sdffce.svg
@@ -0,0 +1,35 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/sdffe.svg b/src/static/Word/Registers/sdffe.svg
new file mode 100644
index 0000000..c429f18
--- /dev/null
+++ b/src/static/Word/Registers/sdffe.svg
@@ -0,0 +1,35 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Registers/sr.svg b/src/static/Word/Registers/sr.svg
new file mode 100644
index 0000000..e3902d7
--- /dev/null
+++ b/src/static/Word/Registers/sr.svg
@@ -0,0 +1,25 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/buf.svg b/src/static/Word/Unary operators/buf.svg
new file mode 100644
index 0000000..d5c1599
--- /dev/null
+++ b/src/static/Word/Unary operators/buf.svg
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/logic_not.svg b/src/static/Word/Unary operators/logic_not.svg
new file mode 100644
index 0000000..da417f5
--- /dev/null
+++ b/src/static/Word/Unary operators/logic_not.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/neg.svg b/src/static/Word/Unary operators/neg.svg
new file mode 100644
index 0000000..e989dde
--- /dev/null
+++ b/src/static/Word/Unary operators/neg.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/not.svg b/src/static/Word/Unary operators/not.svg
new file mode 100644
index 0000000..e6436dd
--- /dev/null
+++ b/src/static/Word/Unary operators/not.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/pos.svg b/src/static/Word/Unary operators/pos.svg
new file mode 100644
index 0000000..83810c9
--- /dev/null
+++ b/src/static/Word/Unary operators/pos.svg
@@ -0,0 +1,13 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/reduce_and.svg b/src/static/Word/Unary operators/reduce_and.svg
new file mode 100644
index 0000000..cf1ec55
--- /dev/null
+++ b/src/static/Word/Unary operators/reduce_and.svg
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/reduce_or.svg b/src/static/Word/Unary operators/reduce_or.svg
new file mode 100644
index 0000000..7669902
--- /dev/null
+++ b/src/static/Word/Unary operators/reduce_or.svg
@@ -0,0 +1,12 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/reduce_xnor.svg b/src/static/Word/Unary operators/reduce_xnor.svg
new file mode 100644
index 0000000..af6c2fb
--- /dev/null
+++ b/src/static/Word/Unary operators/reduce_xnor.svg
@@ -0,0 +1,14 @@
+
+
\ No newline at end of file
diff --git a/src/static/Word/Unary operators/reduce_xor.svg b/src/static/Word/Unary operators/reduce_xor.svg
new file mode 100644
index 0000000..648225c
--- /dev/null
+++ b/src/static/Word/Unary operators/reduce_xor.svg
@@ -0,0 +1,15 @@
+
+
\ No newline at end of file
diff --git a/src/static/analog.svg b/src/static/analog.svg
deleted file mode 100644
index b4650f1..0000000
--- a/src/static/analog.svg
+++ /dev/null
@@ -1,333 +0,0 @@
-
-
diff --git a/src/static/digital.svg b/src/static/digital.svg
deleted file mode 100644
index 28c3cb8..0000000
--- a/src/static/digital.svg
+++ /dev/null
@@ -1,681 +0,0 @@
-
\ No newline at end of file
diff --git a/src/static/dn-0.svg b/src/static/dn-0.svg
deleted file mode 100644
index d44c88d..0000000
--- a/src/static/dn-0.svg
+++ /dev/null
@@ -1,1450 +0,0 @@
-
-
\ No newline at end of file