diff --git a/app/index.html b/app/index.html index 3e2ff3b32..3c8ecbce2 100644 --- a/app/index.html +++ b/app/index.html @@ -16,7 +16,7 @@ - + @@ -37,7 +37,7 @@ - + @@ -49,24 +49,25 @@ + - - + - - - - - - - - + + + + + + + + + diff --git a/app/resources/blocks/bit/0.ice b/app/resources/blocks/bit/0.ice index 12afc6a86..3c7f9feba 100644 --- a/app/resources/blocks/bit/0.ice +++ b/app/resources/blocks/bit/0.ice @@ -16,10 +16,14 @@ "type": "basic.code", "data": { "code": "// Bit 0\n\nassign v = 1'b0;", + "params": [], "ports": { "in": [], "out": [ - "v" + { + "name": "v", + "size": 1 + } ] } }, @@ -32,7 +36,15 @@ "id": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 608, diff --git a/app/resources/blocks/bit/1.ice b/app/resources/blocks/bit/1.ice index ed3410f62..87964be30 100644 --- a/app/resources/blocks/bit/1.ice +++ b/app/resources/blocks/bit/1.ice @@ -16,10 +16,14 @@ "type": "basic.code", "data": { "code": "// Bit 1\n\nassign v = 1'b1;", + "params": [], "ports": { "in": [], "out": [ - "v" + { + "name": "v", + "size": 1 + } ] } }, @@ -32,7 +36,15 @@ "id": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 608, @@ -62,4 +74,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/config/pull_up.ice b/app/resources/blocks/config/pull_up.ice index d36960ce3..d0a3a3e8c 100644 --- a/app/resources/blocks/config/pull_up.ice +++ b/app/resources/blocks/config/pull_up.ice @@ -16,12 +16,19 @@ "type": "basic.code", "data": { "code": "// Pull up\n\nwire din, dout, outen;\n\nassign o = din;\n\nSB_IO #(\n .PIN_TYPE(6'b 1010_01),\n .PULLUP(1'b 1)\n) io_pin (\n .PACKAGE_PIN(i),\n .OUTPUT_ENABLE(outen),\n .D_OUT_0(dout),\n .D_IN_0(din)\n);", + "params": [], "ports": { "in": [ - "i" + { + "name": "i", + "size": 1 + } ], "out": [ - "o" + { + "name": "o", + "size": 1 + } ] } }, @@ -34,7 +41,15 @@ "id": "bb4a1ca9-1b30-471e-92ca-ca7ff2fc1150", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -45,7 +60,15 @@ "id": "a139fa0d-9b45-4480-a251-f4a66b49aa23", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 760, @@ -79,8 +102,8 @@ "deps": {}, "state": { "pan": { - "x": -23, - "y": 8 + "x": 0, + "y": 0 }, "zoom": 1 } diff --git a/app/resources/blocks/config/pull_up_inv.ice b/app/resources/blocks/config/pull_up_inv.ice index 6d8b8a698..129e0c67c 100644 --- a/app/resources/blocks/config/pull_up_inv.ice +++ b/app/resources/blocks/config/pull_up_inv.ice @@ -16,12 +16,19 @@ "type": "basic.code", "data": { "code": "// Pull up inv\n\nwire din, dout, outen;\n\nassign o = ~din;\n\nSB_IO #(\n .PIN_TYPE(6'b 1010_01),\n .PULLUP(1'b 1)\n) io_pin (\n .PACKAGE_PIN(i),\n .OUTPUT_ENABLE(outen),\n .D_OUT_0(dout),\n .D_IN_0(din)\n);", + "params": [], "ports": { "in": [ - "i" + { + "name": "i", + "size": 1 + } ], "out": [ - "o" + { + "name": "o", + "size": 1 + } ] } }, @@ -34,7 +41,15 @@ "id": "bb4a1ca9-1b30-471e-92ca-ca7ff2fc1150", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -45,7 +60,15 @@ "id": "a139fa0d-9b45-4480-a251-f4a66b49aa23", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 760, @@ -79,8 +102,8 @@ "deps": {}, "state": { "pan": { - "x": -23, - "y": 8 + "x": 0, + "y": 0 }, "zoom": 1 } diff --git a/app/resources/blocks/config/tri_state.ice b/app/resources/blocks/config/tri_state.ice index 6a673429d..7168cffa6 100644 --- a/app/resources/blocks/config/tri_state.ice +++ b/app/resources/blocks/config/tri_state.ice @@ -16,14 +16,27 @@ "type": "basic.code", "data": { "code": " SB_IO #(\n .PIN_TYPE(6'b1010_01),\n .PULLUP(1'b0)\n ) triState (\n .PACKAGE_PIN(pin),\n .OUTPUT_ENABLE(oe),\n .D_OUT_0(din),\n .D_IN_0(dout)\n );", + "params": [], "ports": { "in": [ - "pin", - "oe", - "din" + { + "name": "pin", + "size": 1 + }, + { + "name": "oe", + "size": 1 + }, + { + "name": "din", + "size": 1 + } ], "out": [ - "dout" + { + "name": "dout", + "size": 1 + } ] } }, @@ -36,7 +49,15 @@ "id": "076fd025-aa42-4f23-ae97-b65aec2298ce", "type": "basic.input", "data": { - "label": "pin" + "name": "pin", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 32, @@ -47,7 +68,15 @@ "id": "f96a1baf-fc8b-4c25-b132-12552605743f", "type": "basic.input", "data": { - "label": "oe" + "name": "oe", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 32, @@ -58,7 +87,15 @@ "id": "0b2a85b3-b6ac-4e8a-8b16-dd5a195fb058", "type": "basic.output", "data": { - "label": "dout" + "name": "dout", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 760, @@ -69,7 +106,15 @@ "id": "04fdb7a7-2740-4ff1-ad26-56407ef5b958", "type": "basic.input", "data": { - "label": "din" + "name": "din", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 32, @@ -129,4 +174,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/combinational/demux_1_2.ice b/app/resources/blocks/logic/combinational/demux_1_2.ice index 3e844f7e2..6e35eb0a4 100644 --- a/app/resources/blocks/logic/combinational/demux_1_2.ice +++ b/app/resources/blocks/logic/combinational/demux_1_2.ice @@ -16,64 +16,109 @@ "type": "basic.code", "data": { "code": "assign {out1,out0} = in0 << sel0;", + "params": [], "ports": { "in": [ - "in0", - "sel0" + { + "name": "in0", + "size": 1 + }, + { + "name": "sel0", + "size": 1 + } ], "out": [ - "out0", - "out1" + { + "name": "out0", + "size": 1 + }, + { + "name": "out1", + "size": 1 + } ] } }, "position": { - "x": 208, - "y": 64 + "x": 248, + "y": 88 } }, { "id": "5fc9a8e9-d463-4c1f-b6a3-185d5cabb406", "type": "basic.input", "data": { - "label": "i" + "name": "i", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 0, - "y": 96 + "x": 40, + "y": 120 } }, { "id": "91e2ff2d-2430-41e5-9d21-bc9ec4082aaa", "type": "basic.output", "data": { - "label": "o0" + "name": "o0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 720, - "y": 96 + "x": 760, + "y": 120 } }, { "id": "75cafe5a-1968-49ed-9e05-70d1bc3fbd0f", "type": "basic.input", "data": { - "label": "sel" + "name": "sel", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 0, - "y": 224 + "x": 40, + "y": 248 } }, { "id": "c6dc7002-dfc0-45fd-88e2-b5e5a75231f2", "type": "basic.output", "data": { - "label": "o1" + "name": "o1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 720, - "y": 224 + "x": 760, + "y": 248 } } ], @@ -123,10 +168,10 @@ "deps": {}, "state": { "pan": { - "x": 104.8444188797269, - "y": 152.1580250587398 + "x": 0, + "y": 0 }, - "zoom": 0.8586960682653878 + "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/combinational/demux_1_4.ice b/app/resources/blocks/logic/combinational/demux_1_4.ice index 8a4a6fa81..216ad1229 100644 --- a/app/resources/blocks/logic/combinational/demux_1_4.ice +++ b/app/resources/blocks/logic/combinational/demux_1_4.ice @@ -15,11 +15,19 @@ "id": "91e2ff2d-2430-41e5-9d21-bc9ec4082aaa", "type": "basic.output", "data": { - "label": "o0" + "name": "o0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 760, - "y": 40 + "x": 800, + "y": 64 } }, { @@ -27,89 +35,159 @@ "type": "basic.code", "data": { "code": "assign {out3,out2,out1,out0} = in0 << {sel1,sel0};", + "params": [], "ports": { "in": [ - "in0", - "sel0", - "sel1" + { + "name": "in0", + "size": 1 + }, + { + "name": "sel0", + "size": 1 + }, + { + "name": "sel1", + "size": 1 + } ], "out": [ - "out0", - "out1", - "out2", - "out3" + { + "name": "out0", + "size": 1 + }, + { + "name": "out1", + "size": 1 + }, + { + "name": "out2", + "size": 1 + }, + { + "name": "out3", + "size": 1 + } ] } }, "position": { - "x": 208, - "y": 64 + "x": 248, + "y": 88 } }, { "id": "5fc9a8e9-d463-4c1f-b6a3-185d5cabb406", "type": "basic.input", "data": { - "label": "i" + "name": "i", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 72 + "x": 56, + "y": 96 } }, { "id": "c6dc7002-dfc0-45fd-88e2-b5e5a75231f2", "type": "basic.output", "data": { - "label": "o1" + "name": "o1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 760, - "y": 120 + "x": 800, + "y": 144 } }, { "id": "75cafe5a-1968-49ed-9e05-70d1bc3fbd0f", "type": "basic.input", "data": { - "label": "sel0" + "name": "sel0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 160 + "x": 56, + "y": 184 } }, { "id": "5e246f93-51ad-4d6f-83f1-4fcce69c5ae3", "type": "basic.output", "data": { - "label": "o2" + "name": "o2", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 760, - "y": 200 + "x": 800, + "y": 224 } }, { "id": "657dab9e-6580-4f02-b54f-66477863f26a", "type": "basic.input", "data": { - "label": "sel1" + "name": "sel1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 248 + "x": 56, + "y": 272 } }, { "id": "b9d764ea-538a-420f-a8d3-45af7a8e30a2", "type": "basic.output", "data": { - "label": "o3" + "name": "o3", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 760, - "y": 280 + "x": 800, + "y": 304 } } ], @@ -189,10 +267,10 @@ "deps": {}, "state": { "pan": { - "x": 75.84442855228853, - "y": 63.15803102316195 + "x": 11.176135344899718, + "y": 3.2150526334643024 }, - "zoom": 0.8586960434913635 + "zoom": 0.9234510996506167 } } } diff --git a/app/resources/blocks/logic/combinational/demux_1_8.ice b/app/resources/blocks/logic/combinational/demux_1_8.ice index 0784a2757..823421011 100644 --- a/app/resources/blocks/logic/combinational/demux_1_8.ice +++ b/app/resources/blocks/logic/combinational/demux_1_8.ice @@ -15,44 +15,76 @@ "id": "91e2ff2d-2430-41e5-9d21-bc9ec4082aaa", "type": "basic.output", "data": { - "label": "o0" + "name": "o0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": -128 + "x": 760, + "y": -120 } }, { "id": "c6dc7002-dfc0-45fd-88e2-b5e5a75231f2", "type": "basic.output", "data": { - "label": "o1" + "name": "o1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": -48 + "x": 760, + "y": -40 } }, { "id": "5e246f93-51ad-4d6f-83f1-4fcce69c5ae3", "type": "basic.output", "data": { - "label": "o2" + "name": "o2", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": 32 + "x": 760, + "y": 40 } }, { "id": "5fc9a8e9-d463-4c1f-b6a3-185d5cabb406", "type": "basic.input", "data": { - "label": "i" + "name": "i", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 40 + "x": -8, + "y": 48 } }, { @@ -60,116 +92,217 @@ "type": "basic.code", "data": { "code": "assign {out7,out6,out5,out4,out3,out2,out1,out0} = in0 << {sel2,sel1,sel0};", + "params": [], "ports": { "in": [ - "in0", - "sel0", - "sel1", - "sel2" + { + "name": "in0", + "size": 1 + }, + { + "name": "sel0", + "size": 1 + }, + { + "name": "sel1", + "size": 1 + }, + { + "name": "sel2", + "size": 1 + } ], "out": [ - "out0", - "out1", - "out2", - "out3", - "out4", - "out5", - "out6", - "out7" + { + "name": "out0", + "size": 1 + }, + { + "name": "out1", + "size": 1 + }, + { + "name": "out2", + "size": 1 + }, + { + "name": "out3", + "size": 1 + }, + { + "name": "out4", + "size": 1 + }, + { + "name": "out5", + "size": 1 + }, + { + "name": "out6", + "size": 1 + }, + { + "name": "out7", + "size": 1 + } ] } }, "position": { - "x": 208, - "y": 64 + "x": 184, + "y": 72 } }, { "id": "b9d764ea-538a-420f-a8d3-45af7a8e30a2", "type": "basic.output", "data": { - "label": "o3" + "name": "o3", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": 112 + "x": 760, + "y": 120 } }, { "id": "75cafe5a-1968-49ed-9e05-70d1bc3fbd0f", "type": "basic.input", "data": { - "label": "sel0" + "name": "sel0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 120 + "x": -8, + "y": 128 } }, { "id": "657dab9e-6580-4f02-b54f-66477863f26a", "type": "basic.input", "data": { - "label": "sel1" + "name": "sel1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 200 + "x": -8, + "y": 208 } }, { "id": "1b8510ac-d723-4226-bf28-c7329d0f73fb", "type": "basic.output", "data": { - "label": "o4" + "name": "o4", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": 208 + "x": 760, + "y": 216 } }, { "id": "e1a156c8-5813-46f6-a4d4-c672857f3396", "type": "basic.input", "data": { - "label": "sel2" + "name": "sel2", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 16, - "y": 280 + "x": -8, + "y": 288 } }, { "id": "65f31fca-d607-4d5c-82cc-878a93b8e580", "type": "basic.output", "data": { - "label": "o5" + "name": "o5", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": 304 + "x": 760, + "y": 312 } }, { "id": "c8fadd68-77e1-47be-a262-b076e878e6fd", "type": "basic.output", "data": { - "label": "o6" + "name": "o6", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": 384 + "x": 760, + "y": 392 } }, { "id": "99ca2a23-7e0d-4c34-9ab1-988c6bf69633", "type": "basic.output", "data": { - "label": "o7" + "name": "o7", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 784, - "y": 464 + "x": 760, + "y": 472 } } ], @@ -225,8 +358,8 @@ }, "vertices": [ { - "x": 664, - "y": -24 + "x": 640, + "y": -16 } ] }, @@ -241,8 +374,8 @@ }, "vertices": [ { - "x": 664, - "y": 416 + "x": 640, + "y": 424 } ] }, @@ -257,8 +390,8 @@ }, "vertices": [ { - "x": 680, - "y": 32 + "x": 656, + "y": 40 } ] }, @@ -273,8 +406,8 @@ }, "vertices": [ { - "x": 696, - "y": 112 + "x": 672, + "y": 120 } ] }, @@ -289,8 +422,8 @@ }, "vertices": [ { - "x": 712, - "y": 176 + "x": 688, + "y": 184 } ] }, @@ -315,8 +448,8 @@ }, "vertices": [ { - "x": 696, - "y": 288 + "x": 672, + "y": 296 } ] }, @@ -331,20 +464,20 @@ }, "vertices": [ { - "x": 680, - "y": 320 + "x": 656, + "y": 328 }, { - "x": 680, - "y": 360 + "x": 656, + "y": 368 }, { - "x": 680, - "y": 376 + "x": 656, + "y": 384 }, { - "x": 688, - "y": 416 + "x": 664, + "y": 424 } ] } @@ -353,10 +486,10 @@ "deps": {}, "state": { "pan": { - "x": 75.69774669071234, - "y": 148.91048230054443 + "x": 143.76402059142058, + "y": 110.755583226028 }, - "zoom": 0.6331667332315369 + "zoom": 0.7272029968400818 } } } diff --git a/app/resources/blocks/logic/combinational/hex_7seg_ca.ice b/app/resources/blocks/logic/combinational/hex_7seg_ca.ice index 6dc70db99..4435b169b 100644 --- a/app/resources/blocks/logic/combinational/hex_7seg_ca.ice +++ b/app/resources/blocks/logic/combinational/hex_7seg_ca.ice @@ -15,7 +15,15 @@ "id": "8b73e273-3603-443a-b952-0ab9ad826a96", "type": "basic.output", "data": { - "label": "a" + "name": "a", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -26,7 +34,15 @@ "id": "f2fce5fa-be07-46fe-bee1-bb2a497fe747", "type": "basic.output", "data": { - "label": "b" + "name": "b", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -37,7 +53,15 @@ "id": "16e44a6a-853a-4264-9e9d-2269827ed136", "type": "basic.input", "data": { - "label": "h0" + "name": "h0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -49,21 +73,55 @@ "type": "basic.code", "data": { "code": "// Ánodo común\n// gfe_dcba\nlocalparam BCD_0 = 7'b011_1111,\n BCD_1 = 7'b000_0110,\n BCD_2 = 7'b101_1011,\n BCD_3 = 7'b100_1111,\n BCD_4 = 7'b110_0110,\n BCD_5 = 7'b110_1101,\n BCD_6 = 7'b111_1101,\n BCD_7 = 7'b000_0111,\n BCD_8 = 7'b111_1111,\n BCD_9 = 7'b110_1111,\n BCD_A = 7'b111_0111,\n BCD_B = 7'b111_1100,\n BCD_C = 7'b011_1001,\n BCD_D = 7'b101_1110,\n BCD_E = 7'b111_1001,\n BCD_F = 7'b111_0001;\n\nreg [6:0] _o;\n\nalways @(*)\nbegin\n\n case({h3, h2, h1, h0})\n 4'h0: _o <= BCD_0;\n 4'h1: _o <= BCD_1;\n 4'h2: _o <= BCD_2;\n 4'h3: _o <= BCD_3;\n 4'h4: _o <= BCD_4;\n 4'h5: _o <= BCD_5;\n 4'h6: _o <= BCD_6;\n 4'h7: _o <= BCD_7;\n 4'h8: _o <= BCD_8;\n 4'h9: _o <= BCD_9;\n 4'hA: _o <= BCD_A;\n 4'hB: _o <= BCD_B;\n 4'hC: _o <= BCD_C;\n 4'hD: _o <= BCD_D;\n 4'hE: _o <= BCD_E;\n 4'hF: _o <= BCD_F;\n default: _o <= 0;\n endcase\nend\n\nassign {g, f, e, d, c, b, a} = ~_o;", + "params": [], "ports": { "in": [ - "h0", - "h1", - "h2", - "h3" + { + "name": "h0", + "size": 1 + }, + { + "name": "h1", + "size": 1 + }, + { + "name": "h2", + "size": 1 + }, + { + "name": "h3", + "size": 1 + } ], "out": [ - "a", - "b", - "c", - "d", - "e", - "f", - "g" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + }, + { + "name": "c", + "size": 1 + }, + { + "name": "d", + "size": 1 + }, + { + "name": "e", + "size": 1 + }, + { + "name": "f", + "size": 1 + }, + { + "name": "g", + "size": 1 + } ] } }, @@ -76,7 +134,15 @@ "id": "bf0ea22e-3ac2-4756-87d5-020a6ea6a1a8", "type": "basic.output", "data": { - "label": "c" + "name": "c", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -87,7 +153,15 @@ "id": "9cdbdf9f-f086-4427-9719-e13470658d97", "type": "basic.input", "data": { - "label": "h1" + "name": "h1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -98,7 +172,15 @@ "id": "4687e984-3f19-44d7-baee-ca89513f8f1a", "type": "basic.output", "data": { - "label": "d" + "name": "d", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -109,7 +191,15 @@ "id": "f40ab7a8-10e5-4e7f-94f9-cefd697d5d40", "type": "basic.input", "data": { - "label": "h2" + "name": "h2", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -120,7 +210,15 @@ "id": "1691b072-9102-4986-a900-fefd1a5a7b9e", "type": "basic.output", "data": { - "label": "e" + "name": "e", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -131,7 +229,15 @@ "id": "2d774807-3ec8-492c-98e2-f1c9da8d68ff", "type": "basic.input", "data": { - "label": "h3" + "name": "h3", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -142,7 +248,15 @@ "id": "7c14afe7-1ac0-4394-b38e-fa8a00ffa21c", "type": "basic.output", "data": { - "label": "f" + "name": "f", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -153,7 +267,15 @@ "id": "2565c42b-00b0-4b1d-92a4-66c715834b33", "type": "basic.output", "data": { - "label": "g" + "name": "g", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -230,7 +352,13 @@ "target": { "block": "f2fce5fa-be07-46fe-bee1-bb2a497fe747", "port": "in" - } + }, + "vertices": [ + { + "x": 952, + "y": 504 + } + ] }, { "source": { @@ -240,7 +368,13 @@ "target": { "block": "8b73e273-3603-443a-b952-0ab9ad826a96", "port": "in" - } + }, + "vertices": [ + { + "x": 928, + "y": 440 + } + ] }, { "source": { @@ -250,7 +384,13 @@ "target": { "block": "1691b072-9102-4986-a900-fefd1a5a7b9e", "port": "in" - } + }, + "vertices": [ + { + "x": 976, + "y": 704 + } + ] }, { "source": { @@ -260,7 +400,13 @@ "target": { "block": "7c14afe7-1ac0-4394-b38e-fa8a00ffa21c", "port": "in" - } + }, + "vertices": [ + { + "x": 952, + "y": 752 + } + ] }, { "source": { @@ -270,17 +416,23 @@ "target": { "block": "2565c42b-00b0-4b1d-92a4-66c715834b33", "port": "in" - } + }, + "vertices": [ + { + "x": 928, + "y": 824 + } + ] } ] }, "deps": {}, "state": { "pan": { - "x": -155.98941303266986, - "y": -230.62665026580393 + "x": -152.07320110504, + "y": -209.21075900090992 }, - "zoom": 0.7823535799980164 + "zoom": 0.7373584811199316 } } } diff --git a/app/resources/blocks/logic/combinational/hex_7seg_cc.ice b/app/resources/blocks/logic/combinational/hex_7seg_cc.ice index 2aa29a892..9d64d44c5 100644 --- a/app/resources/blocks/logic/combinational/hex_7seg_cc.ice +++ b/app/resources/blocks/logic/combinational/hex_7seg_cc.ice @@ -15,7 +15,15 @@ "id": "8b73e273-3603-443a-b952-0ab9ad826a96", "type": "basic.output", "data": { - "label": "a" + "name": "a", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -26,7 +34,15 @@ "id": "f2fce5fa-be07-46fe-bee1-bb2a497fe747", "type": "basic.output", "data": { - "label": "b" + "name": "b", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -37,7 +53,15 @@ "id": "16e44a6a-853a-4264-9e9d-2269827ed136", "type": "basic.input", "data": { - "label": "h0" + "name": "h0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -49,21 +73,55 @@ "type": "basic.code", "data": { "code": "// Catodo común\n// gfe_dcba\nlocalparam BCD_0 = 7'b011_1111,\n BCD_1 = 7'b000_0110,\n BCD_2 = 7'b101_1011,\n BCD_3 = 7'b100_1111,\n BCD_4 = 7'b110_0110,\n BCD_5 = 7'b110_1101,\n BCD_6 = 7'b111_1101,\n BCD_7 = 7'b000_0111,\n BCD_8 = 7'b111_1111,\n BCD_9 = 7'b110_1111,\n BCD_A = 7'b111_0111,\n BCD_B = 7'b111_1100,\n BCD_C = 7'b011_1001,\n BCD_D = 7'b101_1110,\n BCD_E = 7'b111_1001,\n BCD_F = 7'b111_0001;\n\nreg [6:0] _o;\n\nalways @(*)\nbegin\n\n case({h3, h2, h1, h0})\n 4'h0: _o <= BCD_0;\n 4'h1: _o <= BCD_1;\n 4'h2: _o <= BCD_2;\n 4'h3: _o <= BCD_3;\n 4'h4: _o <= BCD_4;\n 4'h5: _o <= BCD_5;\n 4'h6: _o <= BCD_6;\n 4'h7: _o <= BCD_7;\n 4'h8: _o <= BCD_8;\n 4'h9: _o <= BCD_9;\n 4'hA: _o <= BCD_A;\n 4'hB: _o <= BCD_B;\n 4'hC: _o <= BCD_C;\n 4'hD: _o <= BCD_D;\n 4'hE: _o <= BCD_E;\n 4'hF: _o <= BCD_F;\n default: _o <= 0;\n endcase\nend\n\nassign {g, f, e, d, c, b, a} = _o;", + "params": [], "ports": { "in": [ - "h0", - "h1", - "h2", - "h3" + { + "name": "h0", + "size": 1 + }, + { + "name": "h1", + "size": 1 + }, + { + "name": "h2", + "size": 1 + }, + { + "name": "h3", + "size": 1 + } ], "out": [ - "a", - "b", - "c", - "d", - "e", - "f", - "g" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + }, + { + "name": "c", + "size": 1 + }, + { + "name": "d", + "size": 1 + }, + { + "name": "e", + "size": 1 + }, + { + "name": "f", + "size": 1 + }, + { + "name": "g", + "size": 1 + } ] } }, @@ -76,7 +134,15 @@ "id": "bf0ea22e-3ac2-4756-87d5-020a6ea6a1a8", "type": "basic.output", "data": { - "label": "c" + "name": "c", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -87,7 +153,15 @@ "id": "9cdbdf9f-f086-4427-9719-e13470658d97", "type": "basic.input", "data": { - "label": "h1" + "name": "h1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -98,7 +172,15 @@ "id": "4687e984-3f19-44d7-baee-ca89513f8f1a", "type": "basic.output", "data": { - "label": "d" + "name": "d", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -109,7 +191,15 @@ "id": "f40ab7a8-10e5-4e7f-94f9-cefd697d5d40", "type": "basic.input", "data": { - "label": "h2" + "name": "h2", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -120,7 +210,15 @@ "id": "1691b072-9102-4986-a900-fefd1a5a7b9e", "type": "basic.output", "data": { - "label": "e" + "name": "e", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -131,7 +229,15 @@ "id": "2d774807-3ec8-492c-98e2-f1c9da8d68ff", "type": "basic.input", "data": { - "label": "h3" + "name": "h3", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 312, @@ -142,7 +248,15 @@ "id": "7c14afe7-1ac0-4394-b38e-fa8a00ffa21c", "type": "basic.output", "data": { - "label": "f" + "name": "f", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -153,7 +267,15 @@ "id": "2565c42b-00b0-4b1d-92a4-66c715834b33", "type": "basic.output", "data": { - "label": "g" + "name": "g", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 1016, @@ -230,7 +352,13 @@ "target": { "block": "f2fce5fa-be07-46fe-bee1-bb2a497fe747", "port": "in" - } + }, + "vertices": [ + { + "x": 952, + "y": 528 + } + ] }, { "source": { @@ -240,7 +368,13 @@ "target": { "block": "8b73e273-3603-443a-b952-0ab9ad826a96", "port": "in" - } + }, + "vertices": [ + { + "x": 928, + "y": 448 + } + ] }, { "source": { @@ -260,7 +394,13 @@ "target": { "block": "7c14afe7-1ac0-4394-b38e-fa8a00ffa21c", "port": "in" - } + }, + "vertices": [ + { + "x": 952, + "y": 776 + } + ] }, { "source": { @@ -270,7 +410,13 @@ "target": { "block": "2565c42b-00b0-4b1d-92a4-66c715834b33", "port": "in" - } + }, + "vertices": [ + { + "x": 928, + "y": 824 + } + ] } ] }, @@ -280,7 +426,7 @@ "x": -152.07320110504, "y": -209.21075900090992 }, - "zoom": 0.7373584508895874 + "zoom": 0.7373584371699413 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/combinational/mux_2_1.ice b/app/resources/blocks/logic/combinational/mux_2_1.ice index f10bd5288..1e939fdf3 100644 --- a/app/resources/blocks/logic/combinational/mux_2_1.ice +++ b/app/resources/blocks/logic/combinational/mux_2_1.ice @@ -16,14 +16,27 @@ "type": "basic.code", "data": { "code": "reg _o;\n\nalways @(*) begin\n case(sel0)\n 0: _o = in0;\n 1: _o = in1;\n default: _o = in0;\n endcase\nend\n\nassign o = _o;", + "params": [], "ports": { "in": [ - "in0", - "in1", - "sel0" + { + "name": "in0", + "size": 1 + }, + { + "name": "in1", + "size": 1 + }, + { + "name": "sel0", + "size": 1 + } ], "out": [ - "o" + { + "name": "o", + "size": 1 + } ] } }, @@ -36,7 +49,15 @@ "id": "c3f73f68-1074-4355-b69f-6a20f7bea3e7", "type": "basic.input", "data": { - "label": "i0" + "name": "i0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 80, @@ -47,7 +68,15 @@ "id": "5fb29465-2ee7-45bb-afa4-9a3de895c774", "type": "basic.input", "data": { - "label": "i1" + "name": "i1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 80, @@ -58,7 +87,15 @@ "id": "061aa997-2f30-4591-8841-fb6abf5c3b2e", "type": "basic.output", "data": { - "label": "o" + "name": "o", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 792, @@ -69,7 +106,15 @@ "id": "67ed5e09-486d-4f97-929f-aefea9c43951", "type": "basic.input", "data": { - "label": "sel" + "name": "sel", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 80, @@ -126,7 +171,7 @@ "x": -21.03752160981206, "y": 29.479234822175684 }, - "zoom": 1.000000703366588 + "zoom": 1 } } } diff --git a/app/resources/blocks/logic/combinational/mux_4_1.ice b/app/resources/blocks/logic/combinational/mux_4_1.ice index 7480c7521..66b25ea73 100644 --- a/app/resources/blocks/logic/combinational/mux_4_1.ice +++ b/app/resources/blocks/logic/combinational/mux_4_1.ice @@ -15,7 +15,15 @@ "id": "c3f73f68-1074-4355-b69f-6a20f7bea3e7", "type": "basic.input", "data": { - "label": "i0" + "name": "i0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 40, @@ -26,7 +34,15 @@ "id": "5fb29465-2ee7-45bb-afa4-9a3de895c774", "type": "basic.input", "data": { - "label": "i1" + "name": "i1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 40, @@ -38,17 +54,39 @@ "type": "basic.code", "data": { "code": "reg _o;\nwire [1:0] _sel;\n\nassign _sel = {sel1, sel0};\n\nalways @(*) begin\n case(_sel)\n 0: _o = in0;\n 1: _o = in1;\n 2: _o = in2;\n 3: _o = in3;\n default: _o = in0;\n endcase\nend\n\nassign o = _o;", + "params": [], "ports": { "in": [ - "in0", - "in1", - "in2", - "in3", - "sel0", - "sel1" + { + "name": "in0", + "size": 1 + }, + { + "name": "in1", + "size": 1 + }, + { + "name": "in2", + "size": 1 + }, + { + "name": "in3", + "size": 1 + }, + { + "name": "sel0", + "size": 1 + }, + { + "name": "sel1", + "size": 1 + } ], "out": [ - "o" + { + "name": "o", + "size": 1 + } ] } }, @@ -61,7 +99,15 @@ "id": "67ed5e09-486d-4f97-929f-aefea9c43951", "type": "basic.input", "data": { - "label": "i2" + "name": "i2", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 40, @@ -72,7 +118,15 @@ "id": "061aa997-2f30-4591-8841-fb6abf5c3b2e", "type": "basic.output", "data": { - "label": "o" + "name": "o", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 776, @@ -83,7 +137,15 @@ "id": "8be9cded-6d06-4b23-b73c-94c7ff311dbc", "type": "basic.input", "data": { - "label": "i3" + "name": "i3", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 40, @@ -94,7 +156,15 @@ "id": "1b7db016-c89a-4f65-b6f0-0f87c851c077", "type": "basic.input", "data": { - "label": "sel0" + "name": "sel0", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 40, @@ -105,7 +175,15 @@ "id": "a014971e-5470-490b-9058-b4b00f2dd125", "type": "basic.input", "data": { - "label": "sel1" + "name": "sel1", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 40, @@ -204,7 +282,7 @@ "x": 0, "y": 0 }, - "zoom": 0.9999999999994884 + "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/gate/and.ice b/app/resources/blocks/logic/gate/and.ice index 64b081da8..41d70ac1c 100644 --- a/app/resources/blocks/logic/gate/and.ice +++ b/app/resources/blocks/logic/gate/and.ice @@ -16,13 +16,23 @@ "type": "basic.code", "data": { "code": "// AND logic gate\n\nassign c = a & b;", + "params": [], "ports": { "in": [ - "a", - "b" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -35,7 +45,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -46,7 +64,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -57,7 +83,15 @@ "id": "97b51945-d716-4b6c-9db9-970d08541249", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -104,7 +138,7 @@ "x": 0, "y": 0 }, - "zoom": 0.9999999784900666 + "zoom": 1 } } } diff --git a/app/resources/blocks/logic/gate/nand.ice b/app/resources/blocks/logic/gate/nand.ice index 0d5fe5a31..cb8a28934 100644 --- a/app/resources/blocks/logic/gate/nand.ice +++ b/app/resources/blocks/logic/gate/nand.ice @@ -16,13 +16,23 @@ "type": "basic.code", "data": { "code": "// NAND logic gate\n\nassign c = ~(a & b);", + "params": [], "ports": { "in": [ - "a", - "b" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -35,7 +45,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -46,7 +64,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -57,7 +83,15 @@ "id": "97b51945-d716-4b6c-9db9-970d08541249", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -107,4 +141,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/gate/nor.ice b/app/resources/blocks/logic/gate/nor.ice index 1d9f38242..b1157273c 100644 --- a/app/resources/blocks/logic/gate/nor.ice +++ b/app/resources/blocks/logic/gate/nor.ice @@ -16,13 +16,23 @@ "type": "basic.code", "data": { "code": "// NOR logic gate\n\nassign c = ~(a | b);", + "params": [], "ports": { "in": [ - "a", - "b" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -35,7 +45,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -46,7 +64,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -57,7 +83,15 @@ "id": "97b51945-d716-4b6c-9db9-970d08541249", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, diff --git a/app/resources/blocks/logic/gate/not.ice b/app/resources/blocks/logic/gate/not.ice index 0586db3bc..12ff9752b 100644 --- a/app/resources/blocks/logic/gate/not.ice +++ b/app/resources/blocks/logic/gate/not.ice @@ -16,12 +16,19 @@ "type": "basic.code", "data": { "code": "// NOT logic gate\n\nassign c = ~ a;", + "params": [], "ports": { "in": [ - "a" + { + "name": "a", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -34,7 +41,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -45,7 +60,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -85,4 +108,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/gate/or.ice b/app/resources/blocks/logic/gate/or.ice index 35c0f1515..440294bb7 100644 --- a/app/resources/blocks/logic/gate/or.ice +++ b/app/resources/blocks/logic/gate/or.ice @@ -16,13 +16,23 @@ "type": "basic.code", "data": { "code": "// OR logic gate\n\nassign c = a | b;", + "params": [], "ports": { "in": [ - "a", - "b" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -35,7 +45,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -46,7 +64,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -57,7 +83,15 @@ "id": "97b51945-d716-4b6c-9db9-970d08541249", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -107,4 +141,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/gate/xnor.ice b/app/resources/blocks/logic/gate/xnor.ice index f55df49ff..b90ac28a1 100644 --- a/app/resources/blocks/logic/gate/xnor.ice +++ b/app/resources/blocks/logic/gate/xnor.ice @@ -16,13 +16,23 @@ "type": "basic.code", "data": { "code": "// XNOR logic gate\n\nassign c = ~(a ^ b);", + "params": [], "ports": { "in": [ - "a", - "b" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -35,7 +45,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -46,7 +64,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -57,7 +83,15 @@ "id": "97b51945-d716-4b6c-9db9-970d08541249", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, diff --git a/app/resources/blocks/logic/gate/xor.ice b/app/resources/blocks/logic/gate/xor.ice index 37e840d56..b0a081f16 100644 --- a/app/resources/blocks/logic/gate/xor.ice +++ b/app/resources/blocks/logic/gate/xor.ice @@ -16,13 +16,23 @@ "type": "basic.code", "data": { "code": "// XOR logic gate\n\nassign c = a ^ b;", + "params": [], "ports": { "in": [ - "a", - "b" + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } ], "out": [ - "c" + { + "name": "c", + "size": 1 + } ] } }, @@ -35,7 +45,15 @@ "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -46,7 +64,15 @@ "id": "664caf9e-5f40-4df4-800a-b626af702e62", "type": "basic.output", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 752, @@ -57,7 +83,15 @@ "id": "97b51945-d716-4b6c-9db9-970d08541249", "type": "basic.input", "data": { - "label": "" + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 64, @@ -107,4 +141,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/sequential/debouncer.ice b/app/resources/blocks/logic/sequential/debouncer.ice index d28c6ea5c..3b6019dd2 100644 --- a/app/resources/blocks/logic/sequential/debouncer.ice +++ b/app/resources/blocks/logic/sequential/debouncer.ice @@ -16,52 +16,86 @@ "type": "basic.code", "data": { "code": "//-- Debouncer Circuit\n//-- It produces a stable output when the\n//-- input signal is bouncing\n\nreg btn_prev = 0;\nreg btn_out_r = 0;\n\nreg [16:0] counter = 0;\n\n\nalways @(posedge clk) begin\n\n //-- If btn_prev and btn_in are differents\n if (btn_prev ^ in == 1'b1) begin\n \n //-- Reset the counter\n counter <= 0;\n \n //-- Capture the button status\n btn_prev <= in;\n end\n \n //-- If no timeout, increase the counter\n else if (counter[16] == 1'b0)\n counter <= counter + 1;\n \n else\n //-- Set the output to the stable value\n btn_out_r <= btn_prev;\n\nend\n\nassign out = btn_out_r;\n", + "params": [], "ports": { "in": [ - "clk", - "in" + { + "name": "clk", + "size": 1 + }, + { + "name": "in", + "size": 1 + } ], "out": [ - "out" + { + "name": "out", + "size": 1 + } ] } }, "position": { - "x": 368, - "y": 120 + "x": 264, + "y": 112 } }, { "id": "4bf41c17-a2da-4140-95f7-2a80d51b1e1a", "type": "basic.input", "data": { - "label": "clk" + "name": "clk", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 152, - "y": 152 + "x": 48, + "y": 144 } }, { "id": "22ff3fa1-943b-4d1a-bd89-36e1c054d077", "type": "basic.output", "data": { - "label": "out" + "name": "out", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 872, - "y": 216 + "x": 768, + "y": 208 } }, { "id": "c9e1af2a-6f09-4cf6-a5b3-fdf7ec2c6530", "type": "basic.input", "data": { - "label": "in" + "name": "in", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { - "x": 152, - "y": 280 + "x": 48, + "y": 272 } } ], @@ -104,7 +138,7 @@ "x": 0, "y": 0 }, - "zoom": 0.9999999623653131 + "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/sequential/dff_ar.ice b/app/resources/blocks/logic/sequential/dff_ar.ice index fae0d636e..7f04bfbc3 100644 --- a/app/resources/blocks/logic/sequential/dff_ar.ice +++ b/app/resources/blocks/logic/sequential/dff_ar.ice @@ -15,7 +15,15 @@ "id": "b32a6101-5bd1-4bcf-ae5f-e569b958a6a2", "type": "basic.input", "data": { - "label": "D" + "name": "D", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -27,16 +35,35 @@ "type": "basic.code", "data": { "code": "// D flip-flop with asynchronous reset\n\nreg _q = 1'b0;\n\nalways @(posedge clk or negedge rst_n)\nbegin\n if(rst_n == 0)\n _q = 1'b0;\n else if(en)\n _q <= d;\nend\n\nassign {q, q_n} = {_q, ~_q};\n", + "params": [], "ports": { "in": [ - "d", - "en", - "rst_n", - "clk" + { + "name": "d", + "size": 1 + }, + { + "name": "en", + "size": 1 + }, + { + "name": "rst_n", + "size": 1 + }, + { + "name": "clk", + "size": 1 + } ], "out": [ - "q", - "q_n" + { + "name": "q", + "size": 1 + }, + { + "name": "q_n", + "size": 1 + } ] } }, @@ -49,7 +76,15 @@ "id": "ffdd9aa2-aea3-4aa9-8431-80e799226774", "type": "basic.output", "data": { - "label": "Q" + "name": "Q", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -60,7 +95,15 @@ "id": "50d69ac2-949d-476e-a711-420ba9f510cd", "type": "basic.input", "data": { - "label": "en" + "name": "en", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -71,7 +114,15 @@ "id": "07105e68-401b-49e9-b85f-2cddbfee9fbe", "type": "basic.input", "data": { - "label": "rst*" + "name": "rst*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -82,7 +133,15 @@ "id": "4a261f0b-523c-4fe0-ae1c-de05b8eb7e8a", "type": "basic.output", "data": { - "label": "Q*" + "name": "Q*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -93,7 +152,15 @@ "id": "6855f64f-fa1c-4371-b2e1-a98970674a96", "type": "basic.input", "data": { - "label": "clk" + "name": "clk", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -170,7 +237,7 @@ "x": -100, "y": 0 }, - "zoom": 1.0000000596046377 + "zoom": 1 } } } diff --git a/app/resources/blocks/logic/sequential/dff_sr.ice b/app/resources/blocks/logic/sequential/dff_sr.ice index 2dfabb8d0..f57c59a0d 100644 --- a/app/resources/blocks/logic/sequential/dff_sr.ice +++ b/app/resources/blocks/logic/sequential/dff_sr.ice @@ -15,7 +15,15 @@ "id": "b32a6101-5bd1-4bcf-ae5f-e569b958a6a2", "type": "basic.input", "data": { - "label": "D" + "name": "D", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -27,16 +35,35 @@ "type": "basic.code", "data": { "code": "// D flip-flop with synchronous reset\n\nreg _q = 1'b0;\n\nalways @(posedge clk)\nbegin\n if(rst_n == 0)\n _q = 1'b0;\n else if(en)\n _q <= d;\nend\n\nassign {q, q_n} = {_q, ~_q};\n", + "params": [], "ports": { "in": [ - "d", - "en", - "rst_n", - "clk" + { + "name": "d", + "size": 1 + }, + { + "name": "en", + "size": 1 + }, + { + "name": "rst_n", + "size": 1 + }, + { + "name": "clk", + "size": 1 + } ], "out": [ - "q", - "q_n" + { + "name": "q", + "size": 1 + }, + { + "name": "q_n", + "size": 1 + } ] } }, @@ -49,7 +76,15 @@ "id": "ffdd9aa2-aea3-4aa9-8431-80e799226774", "type": "basic.output", "data": { - "label": "Q" + "name": "Q", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -60,7 +95,15 @@ "id": "50d69ac2-949d-476e-a711-420ba9f510cd", "type": "basic.input", "data": { - "label": "en" + "name": "en", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -71,7 +114,15 @@ "id": "07105e68-401b-49e9-b85f-2cddbfee9fbe", "type": "basic.input", "data": { - "label": "rst*" + "name": "rst*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -82,7 +133,15 @@ "id": "4a261f0b-523c-4fe0-ae1c-de05b8eb7e8a", "type": "basic.output", "data": { - "label": "Q*" + "name": "Q*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -93,7 +152,15 @@ "id": "6855f64f-fa1c-4371-b2e1-a98970674a96", "type": "basic.input", "data": { - "label": "clk" + "name": "clk", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, diff --git a/app/resources/blocks/logic/sequential/tff_ar.ice b/app/resources/blocks/logic/sequential/tff_ar.ice index 33e16dfc7..0c1d6ba47 100644 --- a/app/resources/blocks/logic/sequential/tff_ar.ice +++ b/app/resources/blocks/logic/sequential/tff_ar.ice @@ -15,7 +15,15 @@ "id": "b32a6101-5bd1-4bcf-ae5f-e569b958a6a2", "type": "basic.input", "data": { - "label": "T" + "name": "T", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -27,16 +35,35 @@ "type": "basic.code", "data": { "code": "// T flip-flop with asynchronous reset\n\nreg _q = 1'b0;\n\nalways @(posedge clk or negedge rst_n)\nbegin\n if(rst_n == 0)\n _q <= 1'b0;\n else\n if(en & t)\n _q = ~_q;\nend\n\nassign {q, q_n} = {_q, ~_q};", + "params": [], "ports": { "in": [ - "t", - "en", - "rst_n", - "clk" + { + "name": "t", + "size": 1 + }, + { + "name": "en", + "size": 1 + }, + { + "name": "rst_n", + "size": 1 + }, + { + "name": "clk", + "size": 1 + } ], "out": [ - "q", - "q_n" + { + "name": "q", + "size": 1 + }, + { + "name": "q_n", + "size": 1 + } ] } }, @@ -49,7 +76,15 @@ "id": "ffdd9aa2-aea3-4aa9-8431-80e799226774", "type": "basic.output", "data": { - "label": "Q" + "name": "Q", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -60,7 +95,15 @@ "id": "50d69ac2-949d-476e-a711-420ba9f510cd", "type": "basic.input", "data": { - "label": "en" + "name": "en", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -71,7 +114,15 @@ "id": "8fa94192-fba9-4c2a-be61-b8ca88389423", "type": "basic.input", "data": { - "label": "rst*" + "name": "rst*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -82,7 +133,15 @@ "id": "4a261f0b-523c-4fe0-ae1c-de05b8eb7e8a", "type": "basic.output", "data": { - "label": "Q*" + "name": "Q*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -93,7 +152,15 @@ "id": "6855f64f-fa1c-4371-b2e1-a98970674a96", "type": "basic.input", "data": { - "label": "clk" + "name": "clk", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -173,4 +240,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/blocks/logic/sequential/tff_sr.ice b/app/resources/blocks/logic/sequential/tff_sr.ice index 95267f2e8..825b32d4f 100644 --- a/app/resources/blocks/logic/sequential/tff_sr.ice +++ b/app/resources/blocks/logic/sequential/tff_sr.ice @@ -15,7 +15,15 @@ "id": "b32a6101-5bd1-4bcf-ae5f-e569b958a6a2", "type": "basic.input", "data": { - "label": "T" + "name": "T", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -27,16 +35,35 @@ "type": "basic.code", "data": { "code": "// T flip-flop with synchronous reset\n\nreg _q = 1'b0;\n\nalways @(posedge clk)\nbegin\n if(rst_n == 0)\n _q <= 1'b0;\n else\n if(en & t)\n _q = ~_q;\nend\n\nassign {q, q_n} = {_q, ~_q};", + "params": [], "ports": { "in": [ - "t", - "en", - "rst_n", - "clk" + { + "name": "t", + "size": 1 + }, + { + "name": "en", + "size": 1 + }, + { + "name": "rst_n", + "size": 1 + }, + { + "name": "clk", + "size": 1 + } ], "out": [ - "q", - "q_n" + { + "name": "q", + "size": 1 + }, + { + "name": "q_n", + "size": 1 + } ] } }, @@ -49,7 +76,15 @@ "id": "ffdd9aa2-aea3-4aa9-8431-80e799226774", "type": "basic.output", "data": { - "label": "Q" + "name": "Q", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -60,7 +95,15 @@ "id": "50d69ac2-949d-476e-a711-420ba9f510cd", "type": "basic.input", "data": { - "label": "en" + "name": "en", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -71,7 +114,15 @@ "id": "8fa94192-fba9-4c2a-be61-b8ca88389423", "type": "basic.input", "data": { - "label": "rst*" + "name": "rst*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -82,7 +133,15 @@ "id": "4a261f0b-523c-4fe0-ae1c-de05b8eb7e8a", "type": "basic.output", "data": { - "label": "Q*" + "name": "Q*", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 824, @@ -93,7 +152,15 @@ "id": "6855f64f-fa1c-4371-b2e1-a98970674a96", "type": "basic.input", "data": { - "label": "clk" + "name": "clk", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true }, "position": { "x": 168, @@ -173,4 +240,4 @@ "zoom": 1 } } -} \ No newline at end of file +} diff --git a/app/resources/examples/icestick/1_basic/1_led_on.ice b/app/resources/examples/icestick/1_basic/1_led_on.ice index a4aad45ce..c34f87a6a 100644 --- a/app/resources/examples/icestick/1_basic/1_led_on.ice +++ b/app/resources/examples/icestick/1_basic/1_led_on.ice @@ -1,130 +1,164 @@ { - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 + "version": "1.0", + "package": { + "name": "Led on", + "version": "1.0.0", + "description": "", + "author": "", + "image": "" }, - "board": "icestick", - "graph": { - "blocks": [ - { - "id": "a538a5b4-d5d5-4ace-a593-efb1fa9b930c", - "type": "basic.info", - "data": { - "info": "LED-ON Hello world circuit example!\n\nThe simplest digital circuit that turns a \nled on\n\nA bit set to 1 is wired directly to the\noutput FPGA pin, where the led is connected\n\nThe blue box is the bit (set to 1)\nIt is inside the FPGA\n\nThe yellow box is the output FPGA pin. Using\nthe bottom menu the pin can be changed\n\nEXERCISE 1: Upload this circuit into your \nFPGA board and watch the led. \nIt should be turned on\n\nEXERCISE 2: Change the pin number to turn\nanother led on and upload it again" + "design": { + "board": "icestick", + "graph": { + "blocks": [ + { + "id": "eaf792b5-de98-4e2f-b78a-4023eb9a7f2b", + "type": "bit.1", + "position": { + "x": 80, + "y": 64 + } }, - "position": { - "x": 40, - "y": 208 - } - }, - { - "id": "0d05784e-8e32-4c80-b85d-cde4e892dbf3", - "type": "basic.info", - "data": { - "info": "Ejemplo de circuito Hola mundo: LED-ON\n\nEs el circuito digital más sencillo que\nenciende un led\n\nUn bit a 1 se cablea directamente a una\nsalida de la FPGA, donde está conectado\nel LED\n\nLa caja azul es el bit a 1\nEstá dentro de la FPGA\n\nLa caja amarilla es el pin de salida de\nla FPGA. Por medio del menú desplegable\ninferior se puede cambiar el pin\n\nEJERCICIO 1: Carga este circuito en la FPGA\ny observa el LED0. Debe estar encendido\n\nEJERCICIO 2: Cambia el pin de salida para\nencender otro led (por ejemplo el LED1)\ny cárgalo en la FPGA de nuevo" + { + "id": "949075cb-26c0-49da-ba76-2496ea9aa7cc", + "type": "basic.output", + "data": { + "name": "led", + "pins": [ + { + "index": "0", + "name": "D1", + "value": "99" + } + ], + "virtual": false + }, + "position": { + "x": 352, + "y": 64 + } }, - "position": { - "x": 464, - "y": 208 - } - }, - { - "id": "e657ee6f-9430-4fce-a539-72d12d32f5bb", - "type": "bit.1", - "data": {}, - "position": { - "x": 80, - "y": 64 - } - }, - { - "id": "949075cb-26c0-49da-ba76-2496ea9aa7cc", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "D1", - "value": "99" + { + "id": "a538a5b4-d5d5-4ace-a593-efb1fa9b930c", + "type": "basic.info", + "data": { + "info": "LED-ON Hello world circuit example!\n\nThe simplest digital circuit that turns a \nled on\n\nA bit set to 1 is wired directly to the\noutput FPGA pin, where the led is connected\n\nThe blue box is the bit (set to 1)\nIt is inside the FPGA\n\nThe yellow box is the output FPGA pin. Using\nthe bottom menu the pin can be changed\n\nEXERCISE 1: Upload this circuit into your \nFPGA board and watch the led. \nIt should be turned on\n\nEXERCISE 2: Change the pin number to turn\nanother led on and upload it again" + }, + "position": { + "x": 40, + "y": 208 } }, - "position": { - "x": 352, - "y": 64 + { + "id": "0d05784e-8e32-4c80-b85d-cde4e892dbf3", + "type": "basic.info", + "data": { + "info": "Ejemplo de circuito Hola mundo: LED-ON\n\nEs el circuito digital más sencillo que\nenciende un led\n\nUn bit a 1 se cablea directamente a una\nsalida de la FPGA, donde está conectado\nel LED\n\nLa caja azul es el bit a 1\nEstá dentro de la FPGA\n\nLa caja amarilla es el pin de salida de\nla FPGA. Por medio del menú desplegable\ninferior se puede cambiar el pin\n\nEJERCICIO 1: Carga este circuito en la FPGA\ny observa el LED0. Debe estar encendido\n\nEJERCICIO 2: Cambia el pin de salida para\nencender otro led (por ejemplo el LED1)\ny cárgalo en la FPGA de nuevo" + }, + "position": { + "x": 464, + "y": 208 + } } - } - ], - "wires": [ - { - "source": { - "block": "e657ee6f-9430-4fce-a539-72d12d32f5bb", - "port": "19c8f68d-5022-487f-9ab0-f0a3cd58bead" - }, - "target": { - "block": "949075cb-26c0-49da-ba76-2496ea9aa7cc", - "port": "in" + ], + "wires": [ + { + "source": { + "block": "eaf792b5-de98-4e2f-b78a-4023eb9a7f2b", + "port": "19c8f68d-5022-487f-9ab0-f0a3cd58bead" + }, + "target": { + "block": "949075cb-26c0-49da-ba76-2496ea9aa7cc", + "port": "in" + } } - } - ] - }, - "deps": { - "bit.1": { - "graph": { - "blocks": [ - { - "id": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", - "type": "basic.code", - "data": { - "code": "// Bit 1\n\nassign v = 1'b1;", - "ports": { - "in": [], - "out": [ - "v" - ] + ] + }, + "deps": { + "bit.1": { + "version": "1.0", + "package": { + "name": "Bit 1", + "version": "1.0.0", + "description": "Assign 1 to the output wire", + "author": "Jesús Arroyo", + "image": "%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2247.303%22%20height=%2227.648%22%20viewBox=%220%200%2044.346456%2025.919999%22%3E%3Ctext%20style=%22line-height:125%25%22%20x=%22325.218%22%20y=%22315.455%22%20font-weight=%22400%22%20font-size=%2212.669%22%20font-family=%22sans-serif%22%20letter-spacing=%220%22%20word-spacing=%220%22%20transform=%22translate(-307.01%20-298.51)%22%3E%3Ctspan%20x=%22325.218%22%20y=%22315.455%22%20style=%22-inkscape-font-specification:'Courier%2010%20Pitch'%22%20font-family=%22Courier%2010%20Pitch%22%3E1%3C/tspan%3E%3C/text%3E%3C/svg%3E" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", + "type": "basic.code", + "data": { + "code": "// Bit 1\n\nassign v = 1'b1;", + "params": [], + "ports": { + "in": [], + "out": [ + { + "name": "v", + "size": 1 + } + ] + } + }, + "position": { + "x": 96, + "y": 96 + } + }, + { + "id": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", + "type": "basic.output", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true + }, + "position": { + "x": 608, + "y": 192 + } } - }, - "position": { - "x": 96, - "y": 96 - } + ], + "wires": [ + { + "source": { + "block": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", + "port": "v" + }, + "target": { + "block": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", + "port": "in" + } + } + ] }, - { - "id": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", - "type": "basic.output", - "data": { - "label": "" + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 }, - "position": { - "x": 608, - "y": 192 - } + "zoom": 1 } - ], - "wires": [ - { - "source": { - "block": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", - "port": "v" - }, - "target": { - "block": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", - "port": "in" - } - } - ] - }, - "deps": {}, - "image": "resources/images/1.svg", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 + } } + }, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 } } } \ No newline at end of file diff --git a/app/resources/examples/icezum/1_basic/1_led_on.ice b/app/resources/examples/icezum/1_basic/1_led_on.ice index 672560ecc..c66fb5642 100644 --- a/app/resources/examples/icezum/1_basic/1_led_on.ice +++ b/app/resources/examples/icezum/1_basic/1_led_on.ice @@ -1,130 +1,164 @@ { - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 0.9999999813303895 + "version": "1.0", + "package": { + "name": "Led on", + "version": "1.0.0", + "description": "", + "author": "", + "image": "" }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "a538a5b4-d5d5-4ace-a593-efb1fa9b930c", - "type": "basic.info", - "data": { - "info": "LED-ON Hello world circuit example!\n\nThe simplest digital circuit that turns a \nled on\n\nA bit set to 1 is wired directly to the\noutput FPGA pin, where the led is connected\n\nThe blue box is the bit (set to 1)\nIt is inside the FPGA\n\nThe yellow box is the output FPGA pin. Using\nthe bottom menu the pin can be changed\n\nEXERCISE 1: Upload this circuit into your \nFPGA board and watch the led. \nIt should be turned on\n\nEXERCISE 2: Change the pin number to turn\nanother led on and upload it again" + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "eaf792b5-de98-4e2f-b78a-4023eb9a7f2b", + "type": "bit.1", + "position": { + "x": 80, + "y": 64 + } }, - "position": { - "x": 40, - "y": 208 - } - }, - { - "id": "0d05784e-8e32-4c80-b85d-cde4e892dbf3", - "type": "basic.info", - "data": { - "info": "Ejemplo de circuito Hola mundo: LED-ON\n\nEs el circuito digital más sencillo que\nenciende un led\n\nUn bit a 1 se cablea directamente a una\nsalida de la FPGA, donde está conectado\nel LED\n\nLa caja azul es el bit a 1\nEstá dentro de la FPGA\n\nLa caja amarilla es el pin de salida de\nla FPGA. Por medio del menú desplegable\ninferior se puede cambiar el pin\n\nEJERCICIO 1: Carga este circuito en la FPGA\ny observa el LED0. Debe estar encendido\n\nEJERCICIO 2: Cambia el pin de salida para\nencender otro led (por ejemplo el LED1)\ny cárgalo en la FPGA de nuevo" + { + "id": "949075cb-26c0-49da-ba76-2496ea9aa7cc", + "type": "basic.output", + "data": { + "name": "led", + "pins": [ + { + "index": "0", + "name": "LED0", + "value": "95" + } + ], + "virtual": false + }, + "position": { + "x": 352, + "y": 64 + } }, - "position": { - "x": 464, - "y": 208 - } - }, - { - "id": "e657ee6f-9430-4fce-a539-72d12d32f5bb", - "type": "bit.1", - "data": {}, - "position": { - "x": 80, - "y": 64 - } - }, - { - "id": "949075cb-26c0-49da-ba76-2496ea9aa7cc", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED0", - "value": "95" + { + "id": "a538a5b4-d5d5-4ace-a593-efb1fa9b930c", + "type": "basic.info", + "data": { + "info": "LED-ON Hello world circuit example!\n\nThe simplest digital circuit that turns a \nled on\n\nA bit set to 1 is wired directly to the\noutput FPGA pin, where the led is connected\n\nThe blue box is the bit (set to 1)\nIt is inside the FPGA\n\nThe yellow box is the output FPGA pin. Using\nthe bottom menu the pin can be changed\n\nEXERCISE 1: Upload this circuit into your \nFPGA board and watch the led. \nIt should be turned on\n\nEXERCISE 2: Change the pin number to turn\nanother led on and upload it again" + }, + "position": { + "x": 40, + "y": 208 } }, - "position": { - "x": 352, - "y": 64 + { + "id": "0d05784e-8e32-4c80-b85d-cde4e892dbf3", + "type": "basic.info", + "data": { + "info": "Ejemplo de circuito Hola mundo: LED-ON\n\nEs el circuito digital más sencillo que\nenciende un led\n\nUn bit a 1 se cablea directamente a una\nsalida de la FPGA, donde está conectado\nel LED\n\nLa caja azul es el bit a 1\nEstá dentro de la FPGA\n\nLa caja amarilla es el pin de salida de\nla FPGA. Por medio del menú desplegable\ninferior se puede cambiar el pin\n\nEJERCICIO 1: Carga este circuito en la FPGA\ny observa el LED0. Debe estar encendido\n\nEJERCICIO 2: Cambia el pin de salida para\nencender otro led (por ejemplo el LED1)\ny cárgalo en la FPGA de nuevo" + }, + "position": { + "x": 464, + "y": 208 + } } - } - ], - "wires": [ - { - "source": { - "block": "e657ee6f-9430-4fce-a539-72d12d32f5bb", - "port": "19c8f68d-5022-487f-9ab0-f0a3cd58bead" - }, - "target": { - "block": "949075cb-26c0-49da-ba76-2496ea9aa7cc", - "port": "in" + ], + "wires": [ + { + "source": { + "block": "eaf792b5-de98-4e2f-b78a-4023eb9a7f2b", + "port": "19c8f68d-5022-487f-9ab0-f0a3cd58bead" + }, + "target": { + "block": "949075cb-26c0-49da-ba76-2496ea9aa7cc", + "port": "in" + } } - } - ] - }, - "deps": { - "bit.1": { - "graph": { - "blocks": [ - { - "id": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", - "type": "basic.code", - "data": { - "code": "// Bit 1\n\nassign v = 1'b1;", - "ports": { - "in": [], - "out": [ - "v" - ] + ] + }, + "deps": { + "bit.1": { + "version": "1.0", + "package": { + "name": "Bit 1", + "version": "1.0.0", + "description": "Assign 1 to the output wire", + "author": "Jesús Arroyo", + "image": "%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20width=%2247.303%22%20height=%2227.648%22%20viewBox=%220%200%2044.346456%2025.919999%22%3E%3Ctext%20style=%22line-height:125%25%22%20x=%22325.218%22%20y=%22315.455%22%20font-weight=%22400%22%20font-size=%2212.669%22%20font-family=%22sans-serif%22%20letter-spacing=%220%22%20word-spacing=%220%22%20transform=%22translate(-307.01%20-298.51)%22%3E%3Ctspan%20x=%22325.218%22%20y=%22315.455%22%20style=%22-inkscape-font-specification:'Courier%2010%20Pitch'%22%20font-family=%22Courier%2010%20Pitch%22%3E1%3C/tspan%3E%3C/text%3E%3C/svg%3E" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", + "type": "basic.code", + "data": { + "code": "// Bit 1\n\nassign v = 1'b1;", + "params": [], + "ports": { + "in": [], + "out": [ + { + "name": "v", + "size": 1 + } + ] + } + }, + "position": { + "x": 96, + "y": 96 + } + }, + { + "id": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", + "type": "basic.output", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true + }, + "position": { + "x": 608, + "y": 192 + } } - }, - "position": { - "x": 96, - "y": 96 - } + ], + "wires": [ + { + "source": { + "block": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", + "port": "v" + }, + "target": { + "block": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", + "port": "in" + } + } + ] }, - { - "id": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", - "type": "basic.output", - "data": { - "label": "" + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 }, - "position": { - "x": 608, - "y": 192 - } + "zoom": 1 } - ], - "wires": [ - { - "source": { - "block": "b959fb96-ac67-4aea-90b3-ed35a4c17bf5", - "port": "v" - }, - "target": { - "block": "19c8f68d-5022-487f-9ab0-f0a3cd58bead", - "port": "in" - } - } - ] - }, - "deps": {}, - "image": "resources/images/1.svg", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 + } } + }, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 } } } \ No newline at end of file diff --git a/app/resources/examples/icezum/1_basic/2_switch_led.ice b/app/resources/examples/icezum/1_basic/2_switch_led.ice index 3adf6917a..d428f6e3e 100644 --- a/app/resources/examples/icezum/1_basic/2_switch_led.ice +++ b/app/resources/examples/icezum/1_basic/2_switch_led.ice @@ -1,91 +1,108 @@ { - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 0.9999999883960295 + "version": "1.0", + "package": { + "name": "Switch led", + "version": "1.0.0", + "description": "", + "author": "", + "image": "" }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "aac1b394-533e-4410-9f35-ba80af8abd63", - "type": "basic.input", - "data": { - "label": "button", - "pin": { - "name": "SW1", - "value": "10" + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "aac1b394-533e-4410-9f35-ba80af8abd63", + "type": "basic.input", + "data": { + "name": "button", + "pins": [ + { + "index": "0", + "name": "SW1", + "value": "10" + } + ], + "virtual": false + }, + "position": { + "x": 48, + "y": 80 } }, - "position": { - "x": 48, - "y": 80 - } - }, - { - "id": "30a83e46-176d-40a8-ac0e-f19a131ea9d9", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED0", - "value": "95" + { + "id": "30a83e46-176d-40a8-ac0e-f19a131ea9d9", + "type": "basic.output", + "data": { + "name": "led", + "pins": [ + { + "index": "0", + "name": "LED0", + "value": "95" + } + ], + "virtual": false + }, + "position": { + "x": 320, + "y": 80 } }, - "position": { - "x": 320, - "y": 80 - } - }, - { - "id": "9e124703-5a80-4d0d-8c31-945447862085", - "type": "basic.info", - "data": { - "info": "Switch-led basic example\n\nA simple circuit that connects the input pin,\nwhere there is a button switch, with the\noutpun pin, where there is a led\n\nWhen the button is pressed (1), the led is\nturned on. When the button is released (0), the\nled is turned off\n\nNotice the blue box with a gear. It is a\nconfiguration block for activating the \nFPGA internal pull-up resistor in the SW1 pin" - }, - "position": { - "x": 32, - "y": 224 - } - }, - { - "id": "f76f55d3-ba32-42d8-8c16-9f4cbbd9d27c", - "type": "basic.info", - "data": { - "info": "Ejemplo básico switch-led\n\nSencillo circuito que conecta directamente\nun pin de entrada de la FPGA, donde hay\nun pulsador, con el pin de salida, donde está\nel led\n\nCuando se aprieta el pulsador (1), se enciende\nel led. Cuando se suelta (0) se apaga\n\nFíjate en la caja azul con el engranaje. Es un\nbloque de configuración que permite activar la\nresistencia de pull-up interna del pin de la \nFPGA" + { + "id": "9e124703-5a80-4d0d-8c31-945447862085", + "type": "basic.info", + "data": { + "info": "Switch-led basic example\n\nA simple circuit that connects the input pin,\nwhere there is a button switch, with the\noutpun pin, where there is a led\n\nWhen the button is pressed (1), the led is\nturned on. When the button is released (0), the\nled is turned off\n\nNotice the blue box with a gear. It is a\nconfiguration block for activating the \nFPGA internal pull-up resistor in the SW1 pin" + }, + "position": { + "x": 32, + "y": 224 + } }, - "position": { - "x": 448, - "y": 224 - } - }, - { - "id": "d556c4f6-736a-41a9-9f64-badf2b790010", - "type": "basic.info", - "data": { - "info": "EXERCISE 1: Upload the circuit into your FPGA\nboard and test it!\n\nEXERCISE 2: Change the button to SW2 and test\nit again\n\n---------------------------------------------\nEjercicio 1: Carga el circuito en la FPGA y\n¡pruébalo!\n\nEJERCICIO 2: Cambia el pulsador al SW2 y\npruébalo de nuevo" + { + "id": "f76f55d3-ba32-42d8-8c16-9f4cbbd9d27c", + "type": "basic.info", + "data": { + "info": "Ejemplo básico switch-led\n\nSencillo circuito que conecta directamente\nun pin de entrada de la FPGA, donde hay\nun pulsador, con el pin de salida, donde está\nel led\n\nCuando se aprieta el pulsador (1), se enciende\nel led. Cuando se suelta (0) se apaga\n\nFíjate en la caja azul con el engranaje. Es un\nbloque de configuración que permite activar la\nresistencia de pull-up interna del pin de la \nFPGA" + }, + "position": { + "x": 448, + "y": 224 + } }, - "position": { - "x": 864, - "y": 224 + { + "id": "d556c4f6-736a-41a9-9f64-badf2b790010", + "type": "basic.info", + "data": { + "info": "EXERCISE 1: Upload the circuit into your FPGA\nboard and test it!\n\nEXERCISE 2: Change the button to SW2 and test\nit again\n\n---------------------------------------------\nEjercicio 1: Carga el circuito en la FPGA y\n¡pruébalo!\n\nEJERCICIO 2: Cambia el pulsador al SW2 y\npruébalo de nuevo" + }, + "position": { + "x": 864, + "y": 224 + } } - } - ], - "wires": [ - { - "source": { - "block": "aac1b394-533e-4410-9f35-ba80af8abd63", - "port": "out" - }, - "target": { - "block": "30a83e46-176d-40a8-ac0e-f19a131ea9d9", - "port": "in" + ], + "wires": [ + { + "source": { + "block": "aac1b394-533e-4410-9f35-ba80af8abd63", + "port": "out" + }, + "target": { + "block": "30a83e46-176d-40a8-ac0e-f19a131ea9d9", + "port": "in" + } } - } - ] - }, - "deps": {} + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } } \ No newline at end of file diff --git a/app/resources/examples/icezum/1_basic/3_switch_and_gate.ice b/app/resources/examples/icezum/1_basic/3_switch_and_gate.ice index 50c4778b9..3a7a02bf6 100644 --- a/app/resources/examples/icezum/1_basic/3_switch_and_gate.ice +++ b/app/resources/examples/icezum/1_basic/3_switch_and_gate.ice @@ -1,225 +1,289 @@ { - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 0.9999999999999751 + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "aa8bab8b-61e4-4e28-b444-0e68d9484ea1", - "type": "basic.input", - "data": { - "label": "button1", - "pin": { - "name": "SW1", - "value": "10" + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "aa8bab8b-61e4-4e28-b444-0e68d9484ea1", + "type": "basic.input", + "data": { + "name": "button1", + "pins": [ + { + "index": "0", + "name": "SW1", + "value": "10" + } + ], + "virtual": false + }, + "position": { + "x": 40, + "y": 32 } }, - "position": { - "x": 40, - "y": 32 - } - }, - { - "id": "5d1b4f33-ae65-4154-b4f4-ff1403437600", - "type": "basic.input", - "data": { - "label": "button2", - "pin": { - "name": "SW2", - "value": "11" + { + "id": "840e71b2-bf5a-4e20-8413-d386500c87fa", + "type": "logic.gate.and", + "position": { + "x": 256, + "y": 80 } }, - "position": { - "x": 40, - "y": 128 - } - }, - { - "id": "3cad6e72-e7d3-4273-be1c-ce5f9b4c020a", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED7", - "value": "104" + { + "id": "3cad6e72-e7d3-4273-be1c-ce5f9b4c020a", + "type": "basic.output", + "data": { + "name": "led", + "pins": [ + { + "index": "0", + "name": "LED7", + "value": "104" + } + ], + "virtual": false + }, + "position": { + "x": 440, + "y": 80 } }, - "position": { - "x": 440, - "y": 80 - } - }, - { - "id": "cb5b06e5-0d7d-4c89-9c17-0cd7892369c1", - "type": "logic.and", - "data": {}, - "position": { - "x": 264, - "y": 80 - } - }, - { - "id": "cce8504a-dc1f-4deb-9ee3-5f215ac88408", - "type": "basic.info", - "data": { - "info": "Basic AND gate circuit\n\nA 2-inputs AND logic gate is used to turn on\nthe LED7 only when the 2 input buttons\nare pressed\n\nThis example shows the basic behaviour of\nthe AND gate\n\nEXERCISE: Upload this circuit into the FPGA\nboard and play with it" + { + "id": "5d1b4f33-ae65-4154-b4f4-ff1403437600", + "type": "basic.input", + "data": { + "name": "button2", + "pins": [ + { + "index": "0", + "name": "SW2", + "value": "11" + } + ], + "virtual": false + }, + "position": { + "x": 40, + "y": 128 + } }, - "position": { - "x": 40, - "y": 232 - } - }, - { - "id": "edf3b438-4271-45f7-bb14-2a6d040880dd", - "type": "basic.info", - "data": { - "info": "Circuito básico con puerta AND\n\nUna puerta lógica AND de 2 entradas se usa\npara encender un led solo cuando los dos\npulsadores de entrada están apretados\n\nEste ejemplo muestra el comportamiento básico\nde una puerta AND\n\nEJERCICIO: Carga este circuito en la FPGA y \njuega con él" + { + "id": "cce8504a-dc1f-4deb-9ee3-5f215ac88408", + "type": "basic.info", + "data": { + "info": "Basic AND gate circuit\n\nA 2-inputs AND logic gate is used to turn on\nthe LED7 only when the 2 input buttons\nare pressed\n\nThis example shows the basic behaviour of\nthe AND gate\n\nEXERCISE: Upload this circuit into the FPGA\nboard and play with it" + }, + "position": { + "x": 40, + "y": 232 + } }, - "position": { - "x": 464, - "y": 232 + { + "id": "edf3b438-4271-45f7-bb14-2a6d040880dd", + "type": "basic.info", + "data": { + "info": "Circuito básico con puerta AND\n\nUna puerta lógica AND de 2 entradas se usa\npara encender un led solo cuando los dos\npulsadores de entrada están apretados\n\nEste ejemplo muestra el comportamiento básico\nde una puerta AND\n\nEJERCICIO: Carga este circuito en la FPGA y \njuega con él" + }, + "position": { + "x": 464, + "y": 232 + } } - } - ], - "wires": [ - { - "source": { - "block": "cb5b06e5-0d7d-4c89-9c17-0cd7892369c1", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" + ], + "wires": [ + { + "source": { + "block": "840e71b2-bf5a-4e20-8413-d386500c87fa", + "port": "664caf9e-5f40-4df4-800a-b626af702e62" + }, + "target": { + "block": "3cad6e72-e7d3-4273-be1c-ce5f9b4c020a", + "port": "in" + } }, - "target": { - "block": "3cad6e72-e7d3-4273-be1c-ce5f9b4c020a", - "port": "in" - } - }, - { - "source": { - "block": "aa8bab8b-61e4-4e28-b444-0e68d9484ea1", - "port": "out" + { + "source": { + "block": "aa8bab8b-61e4-4e28-b444-0e68d9484ea1", + "port": "out" + }, + "target": { + "block": "840e71b2-bf5a-4e20-8413-d386500c87fa", + "port": "18c2ebc7-5152-439c-9b3f-851c59bac834" + } }, - "target": { - "block": "cb5b06e5-0d7d-4c89-9c17-0cd7892369c1", - "port": "18c2ebc7-5152-439c-9b3f-851c59bac834" + { + "source": { + "block": "5d1b4f33-ae65-4154-b4f4-ff1403437600", + "port": "out" + }, + "target": { + "block": "840e71b2-bf5a-4e20-8413-d386500c87fa", + "port": "97b51945-d716-4b6c-9db9-970d08541249" + } } - }, - { - "source": { - "block": "5d1b4f33-ae65-4154-b4f4-ff1403437600", - "port": "out" + ] + }, + "deps": { + "logic.gate.and": { + "version": "1.0", + "package": { + "name": "AND", + "version": "1.0.0", + "description": "AND logic gate", + "author": "Jesús Arroyo", + "image": "%3Csvg%20xmlns=%22http://www.w3.org/2000/svg%22%20viewBox=%22-252%20400.9%2090%2040%22%3E%3Cpath%20d=%22M-252%20409.9h26v2h-26zM-252%20429.9h27v2h-27z%22/%3E%3Cpath%20d=%22M-227%20400.9v39.9h20.4c11.3%200%2020-9%2020-20s-8.7-20-20-20H-227zm2.9%202.8h17.6c9.8%200%2016.7%207.6%2016.7%2017.1%200%209.5-7.4%2017.1-17.1%2017.1H-224c-.1.1-.1-34.2-.1-34.2z%22/%3E%3Cpath%20d=%22M-187.911%20419.9H-162v2h-25.911z%22/%3E%3C/svg%3E" }, - "target": { - "block": "cb5b06e5-0d7d-4c89-9c17-0cd7892369c1", - "port": "97b51945-d716-4b6c-9db9-970d08541249" - } - } - ] - }, - "deps": { - "logic.and": { - "graph": { - "blocks": [ - { - "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", - "type": "basic.input", - "data": { - "label": "" - }, - "position": { - "x": 64, - "y": 80 - } - }, - { - "id": "97b51945-d716-4b6c-9db9-970d08541249", - "type": "basic.input", - "data": { - "label": "" - }, - "position": { - "x": 64, - "y": 208 - } - }, - { - "id": "664caf9e-5f40-4df4-800a-b626af702e62", - "type": "basic.output", - "data": { - "label": "" - }, - "position": { - "x": 752, - "y": 144 - } - }, - { - "id": "00925b04-5004-4307-a737-fa4e97c8b6ab", - "type": "basic.code", - "data": { - "code": "// AND logic gate\n\nassign c = a & b;", - "ports": { - "in": [ - "a", - "b" - ], - "out": [ - "c" - ] + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "00925b04-5004-4307-a737-fa4e97c8b6ab", + "type": "basic.code", + "data": { + "code": "// AND logic gate\n\nassign c = a & b;", + "params": [], + "ports": { + "in": [ + { + "name": "a", + "size": 1 + }, + { + "name": "b", + "size": 1 + } + ], + "out": [ + { + "name": "c", + "size": 1 + } + ] + } + }, + "position": { + "x": 256, + "y": 48 + } + }, + { + "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", + "type": "basic.input", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true + }, + "position": { + "x": 64, + "y": 80 + } + }, + { + "id": "664caf9e-5f40-4df4-800a-b626af702e62", + "type": "basic.output", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true + }, + "position": { + "x": 752, + "y": 144 + } + }, + { + "id": "97b51945-d716-4b6c-9db9-970d08541249", + "type": "basic.input", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": "0" + } + ], + "virtual": true + }, + "position": { + "x": 64, + "y": 208 + } } - }, - "position": { - "x": 256, - "y": 48 - } - } - ], - "wires": [ - { - "source": { - "block": "18c2ebc7-5152-439c-9b3f-851c59bac834", - "port": "out" - }, - "target": { - "block": "00925b04-5004-4307-a737-fa4e97c8b6ab", - "port": "a" - } - }, - { - "source": { - "block": "97b51945-d716-4b6c-9db9-970d08541249", - "port": "out" - }, - "target": { - "block": "00925b04-5004-4307-a737-fa4e97c8b6ab", - "port": "b" - } + ], + "wires": [ + { + "source": { + "block": "18c2ebc7-5152-439c-9b3f-851c59bac834", + "port": "out" + }, + "target": { + "block": "00925b04-5004-4307-a737-fa4e97c8b6ab", + "port": "a" + } + }, + { + "source": { + "block": "97b51945-d716-4b6c-9db9-970d08541249", + "port": "out" + }, + "target": { + "block": "00925b04-5004-4307-a737-fa4e97c8b6ab", + "port": "b" + } + }, + { + "source": { + "block": "00925b04-5004-4307-a737-fa4e97c8b6ab", + "port": "c" + }, + "target": { + "block": "664caf9e-5f40-4df4-800a-b626af702e62", + "port": "in" + } + } + ] }, - { - "source": { - "block": "00925b04-5004-4307-a737-fa4e97c8b6ab", - "port": "c" + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 }, - "target": { - "block": "664caf9e-5f40-4df4-800a-b626af702e62", - "port": "in" - } + "zoom": 1 } - ] - }, - "deps": {}, - "image": "resources/images/and.svg", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 + } } + }, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 } } } \ No newline at end of file diff --git a/app/scripts/controllers/menu.js b/app/scripts/controllers/menu.js index 23de657d1..5b8e59c6c 100644 --- a/app/scripts/controllers/menu.js +++ b/app/scripts/controllers/menu.js @@ -76,6 +76,9 @@ angular.module('icestudio') if (name) { project.new(name); } + else { + evt.cancel = true; + } }); }; diff --git a/app/scripts/plugins/shapes/joint.shapes.js b/app/scripts/plugins/shapes/joint.shapes.js index f7699e8f9..094479257 100644 --- a/app/scripts/plugins/shapes/joint.shapes.js +++ b/app/scripts/plugins/shapes/joint.shapes.js @@ -18,7 +18,7 @@ joint.shapes.ice = {}; joint.shapes.ice.Model = joint.shapes.basic.Generic.extend({ markup: '', - portMarkup: '', + portMarkup: '', defaults: joint.util.deepSupplement({ type: 'ice.Model', @@ -183,74 +183,88 @@ joint.shapes.ice.Model = joint.shapes.basic.Generic.extend({ joint.shapes.ice.ModelView = joint.dia.ElementView.extend({ - template: '', + template: '', - initialize: function() { - _.bindAll(this, 'updateBox'); - joint.dia.ElementView.prototype.initialize.apply(this, arguments); - - this.$box = $(joint.util.template(this.template)()); - - this.model.on('change', this.updateBox, this); - this.model.on('remove', this.removeBox, this); + initialize: function() { + _.bindAll(this, 'updateBox'); + joint.dia.ElementView.prototype.initialize.apply(this, arguments); - this.updateBox(); + this.$box = $(joint.util.template(this.template)()); - this.listenTo(this.model, 'process:ports', this.update); - joint.dia.ElementView.prototype.initialize.apply(this, arguments); - }, + this.model.on('change', this.updateBox, this); + this.model.on('remove', this.removeBox, this); - render: function() { - joint.dia.ElementView.prototype.render.apply(this, arguments); - this.paper.$el.append(this.$box); - this.updateBox(); - return this; - }, + this.updateBox(); - renderPorts: function() { - var $leftPorts = this.$('.leftPorts').empty(); - var $rightPorts = this.$('.rightPorts').empty(); - var $topPorts = this.$('.topPorts').empty(); - var $bottomPorts = this.$('.bottomPorts').empty(); - var portTemplate = _.template(this.model.portMarkup); + this.listenTo(this.model, 'process:ports', this.update); + joint.dia.ElementView.prototype.initialize.apply(this, arguments); + }, - _.each(_.filter(this.model.ports, function (p) { return p.type === 'left'; }), function (port, index) { - $leftPorts.append(V(portTemplate({ id: index, port: port })).node); - }); - _.each(_.filter(this.model.ports, function (p) { return p.type === 'right'; }), function (port, index) { - $rightPorts.append(V(portTemplate({ id: index, port: port })).node); - }); - _.each(_.filter(this.model.ports, function (p) { return p.type === 'top'; }), function (port, index) { - $topPorts.append(V(portTemplate({ id: index, port: port })).node); - }); - _.each(_.filter(this.model.ports, function (p) { return p.type === 'bottom'; }), function (port, index) { - $bottomPorts.append(V(portTemplate({ id: index, port: port })).node); - }); - }, + render: function() { + joint.dia.ElementView.prototype.render.apply(this, arguments); + this.paper.$el.append(this.$box); + this.updateBox(); + return this; + }, - update: function() { - this.renderPorts(); - joint.dia.ElementView.prototype.update.apply(this, arguments); - }, + renderPorts: function() { + var $leftPorts = this.$('.leftPorts').empty(); + var $rightPorts = this.$('.rightPorts').empty(); + var $topPorts = this.$('.topPorts').empty(); + var $bottomPorts = this.$('.bottomPorts').empty(); + var portTemplate = _.template(this.model.portMarkup); + + _.each(_.filter(this.model.ports, function (p) { return p.type === 'left'; }), function (port, index) { + $leftPorts.append(V(portTemplate({ id: index, port: port })).node); + }); + _.each(_.filter(this.model.ports, function (p) { return p.type === 'right'; }), function (port, index) { + $rightPorts.append(V(portTemplate({ id: index, port: port })).node); + }); + _.each(_.filter(this.model.ports, function (p) { return p.type === 'top'; }), function (port, index) { + $topPorts.append(V(portTemplate({ id: index, port: port })).node); + }); + _.each(_.filter(this.model.ports, function (p) { return p.type === 'bottom'; }), function (port, index) { + $bottomPorts.append(V(portTemplate({ id: index, port: port })).node); + }); + }, - updateBox: function() { - var bbox = this.model.getBBox(); - var state = this.model.attributes.state; + update: function() { + this.renderPorts(); + joint.dia.ElementView.prototype.update.apply(this, arguments); + }, - this.$('.port-wire').css('stroke-width', 2 * state.zoom); + updateBox: function() { + var port, wireWidth; + var bbox = this.model.getBBox(); + var state = this.model.get('state'); + var leftPorts = this.model.get('leftPorts'); + var rightPorts = this.model.get('rightPorts'); + + // Render ports width + this.$('.port-wire').css('stroke-width', 2 * state.zoom); + for (var i in leftPorts) { + port = leftPorts[i]; + wireWidth = (port.size > 1) ? 8 : 2; + this.$('#port-wire-' + port.id).css('stroke-width', wireWidth * state.zoom); + } + for (var o in rightPorts) { + port = rightPorts[o]; + wireWidth = (port.size > 1) ? 8 : 2; + this.$('#port-wire-' + port.id).css('stroke-width', wireWidth * state.zoom); + } - this.$box.css({ - left: bbox.x * state.zoom + state.pan.x + bbox.width / 2.0 * (state.zoom - 1), - top: bbox.y * state.zoom + state.pan.y + bbox.height / 2.0 * (state.zoom - 1), - width: bbox.width, - height: bbox.height, - transform: 'scale(' + state.zoom + ')' - }); - }, + this.$box.css({ + left: bbox.x * state.zoom + state.pan.x + bbox.width / 2.0 * (state.zoom - 1), + top: bbox.y * state.zoom + state.pan.y + bbox.height / 2.0 * (state.zoom - 1), + width: bbox.width, + height: bbox.height, + transform: 'scale(' + state.zoom + ')' + }); + }, - removeBox: function(/*evt*/) { - this.$box.remove(); - } + removeBox: function(/*evt*/) { + this.$box.remove(); + } }); @@ -264,30 +278,30 @@ joint.shapes.ice.Generic = joint.shapes.ice.Model.extend({ joint.shapes.ice.GenericView = joint.shapes.ice.ModelView.extend({ - template: '\ -
\ - \ - \ -
\ - ', + template: '\ +
\ + \ + \ +
\ + ', - initialize: function() { - joint.shapes.ice.ModelView.prototype.initialize.apply(this, arguments); + initialize: function() { + joint.shapes.ice.ModelView.prototype.initialize.apply(this, arguments); - var image = this.model.get('image'); - var name = this.model.get('label'); + var image = this.model.get('image'); + var name = this.model.get('label'); - if (image) { - this.$box.find('img').attr('src', 'data:image/svg+xml,' + image); - this.$box.find('img').removeClass('hidden'); - this.$box.find('label').addClass('hidden'); - } - else { - this.$box.find('label').text(name); - this.$box.find('img').addClass('hidden'); - this.$box.find('label').removeClass('hidden'); - } + if (image) { + this.$box.find('img').attr('src', 'data:image/svg+xml,' + image); + this.$box.find('img').removeClass('hidden'); + this.$box.find('label').addClass('hidden'); + } + else { + this.$box.find('label').html(name); + this.$box.find('img').addClass('hidden'); + this.$box.find('label').removeClass('hidden'); } + } }); // I/O blocks @@ -295,12 +309,6 @@ joint.shapes.ice.GenericView = joint.shapes.ice.ModelView.extend({ joint.shapes.ice.Input = joint.shapes.ice.Model.extend({ defaults: joint.util.deepSupplement({ type: 'ice.Input', - choices: [], - rightPorts: [{ - id: 'out', - label: '', - gridUnits: 8 - }], size: { width: 96, height: 64 @@ -311,12 +319,6 @@ joint.shapes.ice.Input = joint.shapes.ice.Model.extend({ joint.shapes.ice.Output = joint.shapes.ice.Model.extend({ defaults: joint.util.deepSupplement({ type: 'ice.Output', - choices: [], - leftPorts: [{ - id: 'in', - label: '', - gridUnits: 8 - }], size: { width: 96, height: 64 @@ -327,61 +329,137 @@ joint.shapes.ice.Output = joint.shapes.ice.Model.extend({ joint.shapes.ice.IOView = joint.shapes.ice.ModelView.extend({ - template: '\ -
\ - \ - \ - \ -
\ - ', - - initialize: function() { - joint.shapes.ice.ModelView.prototype.initialize.apply(this, arguments); - - // Prevent paper from handling pointerdown. - this.$box.find('.io-combo').on('mousedown click', function(evt) { evt.stopPropagation(); }); - - this.$box.find('.io-combo').on('change', _.bind(function(evt) { - this.model.attributes.data.pin.name = $(evt.target).find('option:selected').text(); - this.model.attributes.data.pin.value = $(evt.target).val(); - }, this)); - }, - renderLabel: function () { - var name = this.model.attributes.data.label; - this.$box.find('label').text(name); - }, - renderChoices: function() { - if (this.model.get('disabled')) { - this.$box.find('.io-combo').removeClass('select2'); - this.$box.find('.io-combo').css({'display': 'none'}); + initialize: function() { + joint.shapes.ice.ModelView.prototype.initialize.apply(this, arguments); + + this.id = sha1(this.model.get('id')).toString().substring(0, 6); + var virtualPortId = 'virtualPort' + this.id; + var fpgaPortId = 'fpgaPort' + this.id; + var comboId = 'combo' + this.id; + var virtual = this.model.get('data').virtual || this.model.get('disabled'); + + var selectCode = ''; + var selectScript = ''; + this.pins = this.model.get('data').pins; + + if (this.pins) { + for (var i in this.pins) { + //selectCode += '

' + this.pins[i].index + '

'; + selectCode +=''; + + selectScript += '$("#' + comboId + this.pins[i].index + '").select2('; + selectScript += '{placeholder: "", allowClear: true, dropdownCssClass: "bigdrop"});'; } - else { - var choices = this.model.get('choices'); - var $select = this.$box.find('.io-combo').empty(); + } - $select.append(''); - for (var c in choices) { - $select.append(''); - } + this.$box = $(joint.util.template( + '\ +
\ + \ +
\ +
\ + \ +
' + selectCode + '
\ + \ +
\ + ' + )()); + + // Prevent paper from handling pointerdown. + var comboSelector = this.$box.find('.select2'); + comboSelector.on('mousedown click', function(evt) { evt.stopPropagation(); }); + comboSelector.on('change', _.bind(function(evt) { + var target = $(evt.target); + var i = target.attr('i'); + var name = target.find('option:selected').text(); + var value = target.val(); + this.model.attributes.data.pins[i].name = name; + this.model.attributes.data.pins[i].value = value; + //comboSelector.find('.select2-selection').css('font-size', this.computeFontSize(name)); + }, this)); + + // Render data + if (!this.model.get('disabled')) { + this.renderChoices(); + this.renderValue(); + } + }, - if (this.model.get('data').pin) { - this.$box.find('.io-combo').val(this.model.get('data').pin.value); - } + renderBlock: function() { + var virtualPortId = '#virtualPort' + this.id; + var fpgaPortId = '#fpgaPort' + this.id; + var data = this.model.get('data'); + var name = data.name + (data.range ? data.range : ''); + var virtual = data.virtual || this.model.get('disabled'); + + this.$box.find('label').text(name ? name : ' '); + + // Virtual -> FPGA I/O + // FPGA I/O -> Virtual + + if (virtual) { + // Virtual port (green) + $(fpgaPortId).addClass('hidden'); + $(virtualPortId).removeClass('hidden'); + this.model.attributes.size.height = 64; + } + else { + // FPGA I/O port (yellow) + $(virtualPortId).addClass('hidden'); + $(fpgaPortId).removeClass('hidden'); + if (this.pins) { + this.model.attributes.size.height = 32 + 32 * this.pins.length; + // TODO: move block and wire + //var bbox = this.model.getBBox(); + //var state = this.model.attributes.state; + //this.$box.css({ top: bbox.y * state.zoom + state.pan.y }); + } + } + }, + + renderChoices: function() { + if (this.pins) { + for (var i in this.pins) { + this.$box.find('#combo' + this.id + this.pins[i].index).empty().append(this.model.get('choices')); + } + } + }, + + renderValue: function() { + if (this.pins) { + for (var i in this.pins) { + var index = this.pins[i].index; + var comboId = 'combo' + this.id + index; + var comboSelector = this.$box.find('#' + comboId); + comboSelector.val(this.pins[i].value); + //var fontSize = this.computeFontSize(this.pins[i].name); + //$('#select2-' + comboId + '-container').css('font-size', fontSize); + } + } + }, + + clearValue: function () { + if (this.pins) { + for (var i in this.pins) { + this.$box.find('#combo' + this.id + this.pins[i].index).val(''); + this.model.attributes.data.pins[i].name = ''; + this.model.attributes.data.pins[i].value = 0; } - }, - clearValue: function () { - this.model.attributes.data.pin.name = ''; - this.model.attributes.data.pin.value = 0; - this.$box.find('.io-combo').val(''); - }, - update: function () { - this.renderLabel(); - this.renderPorts(); - this.renderChoices(); - joint.dia.ElementView.prototype.update.apply(this, arguments); } + }, + + computeFontSize: function(name) { + var n = name.length; + return Math.min(13, 17-n).toString() + 'px'; + }, + + update: function () { + this.renderPorts(); + this.renderBlock(); + joint.dia.ElementView.prototype.update.apply(this, arguments); + } }); joint.shapes.ice.InputView = joint.shapes.ice.IOView; @@ -393,11 +471,6 @@ joint.shapes.ice.OutputView = joint.shapes.ice.IOView; joint.shapes.ice.Constant = joint.shapes.ice.Model.extend({ defaults: joint.util.deepSupplement({ type: 'ice.Constant', - bottomPorts: [{ - id: 'constant-out', - label: '', - gridUnits: 8 - }], size: { width: 96, height: 64 @@ -408,52 +481,57 @@ joint.shapes.ice.Constant = joint.shapes.ice.Model.extend({ joint.shapes.ice.ConstantView = joint.shapes.ice.ModelView.extend({ - template: '\ -
\ -

*

\ - \ - \ -
\ - ', + template: '\ +
\ +

*

\ + \ + \ +
\ + ', - initialize: function() { - joint.shapes.ice.ModelView.prototype.initialize.apply(this, arguments); + initialize: function() { + joint.shapes.ice.ModelView.prototype.initialize.apply(this, arguments); - // Prevent paper from handling pointerdown. - this.$box.find('.constant-input').on('mousedown click', function(evt) { evt.stopPropagation(); }); + // Prevent paper from handling pointerdown. + this.$box.find('.constant-input').on('mousedown click', function(evt) { evt.stopPropagation(); }); - this.$box.find('.constant-input').on('input', _.bind(function(evt) { - this.model.attributes.data.value = $(evt.target).val(); - }, this)); - }, - renderLocal: function() { - if (this.model.get('data').local) { - this.$box.find('p').removeClass('hidden'); - } - else { - this.$box.find('p').addClass('hidden'); - } - }, - renderLabel: function () { - var name = this.model.attributes.data.label; - this.$box.find('label').text(name); - }, - renderValue: function() { - if (this.model.get('disabled')) { - this.$box.find('.constant-input').css({'pointer-events': 'none'}); - } - this.$box.find('.constant-input').val(this.model.get('data').value); - }, - clearValue: function () { - this.$box.find('.constant-input').val(''); - }, - update: function () { - this.renderLocal(); - this.renderLabel(); - this.renderPorts(); - this.renderValue(); - joint.dia.ElementView.prototype.update.apply(this, arguments); + this.$box.find('.constant-input').on('input', _.bind(function(evt) { + this.model.attributes.data.value = $(evt.target).val(); + }, this)); + }, + + renderLocal: function() { + if (this.model.get('data').local) { + this.$box.find('p').removeClass('hidden'); + } + else { + this.$box.find('p').addClass('hidden'); + } + }, + + renderLabel: function () { + var name = this.model.get('data').name; + this.$box.find('label').text(name); + }, + + renderValue: function() { + if (this.model.get('disabled')) { + this.$box.find('.constant-input').css({'pointer-events': 'none'}); } + this.$box.find('.constant-input').val(this.model.get('data').value); + }, + + clearValue: function () { + this.$box.find('.constant-input').val(''); + }, + + update: function () { + this.renderLocal(); + this.renderLabel(); + this.renderPorts(); + this.renderValue(); + joint.dia.ElementView.prototype.update.apply(this, arguments); + } }); @@ -478,70 +556,91 @@ joint.shapes.ice.Code = joint.shapes.ice.Model.extend({ joint.shapes.ice.CodeView = joint.shapes.ice.ModelView.extend({ - initialize: function() { - _.bindAll(this, 'updateBox'); - joint.dia.ElementView.prototype.initialize.apply(this, arguments); - - var id = sha1(this.model.get('id')).toString().substring(0, 6); - var blockLabel = 'block' + id; - var editorLabel = 'editor' + id; - var contentLabel = 'content' + id; - this.$box = $(joint.util.template( - '\ -
\ -
\ - \ - \ -
\ - ' - )()); - - this.model.on('change', this.updateBox, this); - this.model.on('remove', this.removeBox, this); - - this.updateBox(); - - this.listenTo(this.model, 'process:ports', this.update); - joint.dia.ElementView.prototype.initialize.apply(this, arguments); - - // Prevent paper from handling pointerdown. - this.$box.find('#' + editorLabel).on('mousedown click', function(evt) { evt.stopPropagation(); }); + initialize: function() { + _.bindAll(this, 'updateBox'); + joint.dia.ElementView.prototype.initialize.apply(this, arguments); + + var id = sha1(this.model.get('id')).toString().substring(0, 6); + var blockLabel = 'block' + id; + var editorLabel = 'editor' + id; + var contentLabel = 'content' + id; + this.$box = $(joint.util.template( + '\ +
\ +
\ + \ + \ +
\ + ' + )()); + + this.model.on('change', this.updateBox, this); + this.model.on('remove', this.removeBox, this); + + this.updateBox(); + + this.listenTo(this.model, 'process:ports', this.update); + joint.dia.ElementView.prototype.initialize.apply(this, arguments); + + // Prevent paper from handling pointerdown. + this.$box.find('#' + editorLabel).on('mousedown click', function(evt) { evt.stopPropagation(); }); + + this.$box.find('#' + editorLabel).append(this.model.get('data').code); + this.$box.find('#' + contentLabel).append(this.model.get('data').code); + }, - this.$box.find('#' + editorLabel).append(this.model.attributes.data.code); - this.$box.find('#' + contentLabel).append(this.model.attributes.data.code); - }, - update: function () { - this.renderPorts(); - var id = sha1(this.model.get('id')).toString().substring(0, 6); - var editorLabel = 'editor' + id; - var editor = ace.edit(this.$box.find('#' + editorLabel)[0]); - editor.setReadOnly(this.model.get('disabled')); - joint.dia.ElementView.prototype.update.apply(this, arguments); - }, - updateBox: function() { - var bbox = this.model.getBBox(); - var state = this.model.attributes.state; + renderValue: function() { + var id = sha1(this.model.get('id')).toString().substring(0, 6); + var editorLabel = 'editor' + id; + var editor = ace.edit(this.$box.find('#' + editorLabel)[0]); + editor.setReadOnly(this.model.get('disabled')); + }, - this.$('.port-wire').css('stroke-width', 2 * state.zoom); + update: function () { + this.renderPorts(); + this.renderValue(); + joint.dia.ElementView.prototype.update.apply(this, arguments); + }, - this.$box.css({ width: bbox.width * state.zoom, - height: bbox.height * state.zoom, - left: bbox.x * state.zoom + state.pan.x, - top: bbox.y * state.zoom + state.pan.y }); + updateBox: function() { + var port, wireWidth; + var bbox = this.model.getBBox(); + var state = this.model.get('state'); + var leftPorts = this.model.get('leftPorts'); + var rightPorts = this.model.get('rightPorts'); + + // Render ports width + this.$('.port-wire').css('stroke-width', 2 * state.zoom); + for (var i in leftPorts) { + port = leftPorts[i]; + wireWidth = (port.size > 1) ? 8 : 2; + this.$('#port-wire-' + port.id).css('stroke-width', wireWidth * state.zoom); } + for (var o in rightPorts) { + port = rightPorts[o]; + wireWidth = (port.size > 1) ? 8 : 2; + this.$('#port-wire-' + port.id).css('stroke-width', wireWidth * state.zoom); + } + + this.$box.css({ width: bbox.width * state.zoom, + height: bbox.height * state.zoom, + left: bbox.x * state.zoom + state.pan.x, + top: bbox.y * state.zoom + state.pan.y }); + // 'border-width': 2 * state.zoom: problem int instead of float + } }); @@ -569,72 +668,76 @@ joint.shapes.ice.Info = joint.shapes.basic.Rect.extend({ joint.shapes.ice.InfoView = joint.dia.ElementView.extend({ - initialize: function() { - _.bindAll(this, 'updateBox'); - joint.dia.ElementView.prototype.initialize.apply(this, arguments); - - var id = sha1(this.model.get('id')).toString().substring(0, 6); - var blockLabel = 'block' + id; - var editorLabel = 'editor' + id; - var contentLabel = 'content' + id; - this.$box = $(joint.util.template( - '\ -
\ -
\ - \ - \ -
\ - ' - )()); - - this.model.on('change', this.updateBox, this); - this.model.on('remove', this.removeBox, this); + initialize: function() { + _.bindAll(this, 'updateBox'); + joint.dia.ElementView.prototype.initialize.apply(this, arguments); + + var id = sha1(this.model.get('id')).toString().substring(0, 6); + var blockLabel = 'block' + id; + var editorLabel = 'editor' + id; + var contentLabel = 'content' + id; + this.$box = $(joint.util.template( + '\ +
\ +
\ + \ + \ +
\ + ' + )()); + + this.model.on('change', this.updateBox, this); + this.model.on('remove', this.removeBox, this); + + this.updateBox(); + + // Prevent paper from handling pointerdown. + this.$box.find('#' + editorLabel).on('mousedown click', function(evt) { evt.stopPropagation(); }); + + this.$box.find('#' + editorLabel).append(this.model.get('data').info); + this.$box.find('#' + contentLabel).append(this.model.get('data').info); + }, + render: function () { + joint.dia.ElementView.prototype.render.apply(this, arguments); + this.paper.$el.append(this.$box); this.updateBox(); + return this; + }, - // Prevent paper from handling pointerdown. - this.$box.find('#' + editorLabel).on('mousedown click', function(evt) { evt.stopPropagation(); }); + update: function () { + var id = sha1(this.model.get('id')).toString().substring(0, 6); + var editorLabel = 'editor' + id; + var editor = ace.edit(this.$box.find('#' + editorLabel)[0]); + editor.setReadOnly(this.model.get('disabled')); + joint.dia.ElementView.prototype.update.apply(this, arguments); + }, - this.$box.find('#' + editorLabel).append(this.model.attributes.data.info); - this.$box.find('#' + contentLabel).append(this.model.attributes.data.info); - }, - render: function () { - joint.dia.ElementView.prototype.render.apply(this, arguments); - this.paper.$el.append(this.$box); - this.updateBox(); - return this; - }, - update: function () { - var id = sha1(this.model.get('id')).toString().substring(0, 6); - var editorLabel = 'editor' + id; - var editor = ace.edit(this.$box.find('#' + editorLabel)[0]); - editor.setReadOnly(this.model.get('disabled')); - joint.dia.ElementView.prototype.update.apply(this, arguments); - }, - updateBox: function() { - var bbox = this.model.getBBox(); - var state = this.model.attributes.state; - - this.$box.css({ width: bbox.width * state.zoom, - height: bbox.height * state.zoom, - left: bbox.x * state.zoom + state.pan.x, - top: bbox.y * state.zoom + state.pan.y }); - }, - removeBox: function(/*evt*/) { - this.$box.remove(); - } + updateBox: function() { + var bbox = this.model.getBBox(); + var state = this.model.get('state'); + + this.$box.css({ width: bbox.width * state.zoom, + height: bbox.height * state.zoom, + left: bbox.x * state.zoom + state.pan.x, + top: bbox.y * state.zoom + state.pan.y }); + }, + + removeBox: function(/*evt*/) { + this.$box.remove(); + } }); @@ -656,7 +759,7 @@ joint.shapes.ice.Wire = joint.dia.Link.extend({ bifurcationMarkup: [ '', - '', + '', '' ].join(''), @@ -670,18 +773,19 @@ joint.shapes.ice.Wire = joint.dia.Link.extend({ type: 'ice.Wire', - /*labels: [ + labels: [ { - position: .5, + position: 0.5, attrs: { text: { - text: ' /8 ' || '', + text: '', 'font-weight': 'bold', - 'font-size': '150%' + 'font-size': '150%', + 'y': '12px' } } } - ],*/ + ], attrs: { '.connection': { @@ -700,6 +804,30 @@ joint.shapes.ice.Wire = joint.dia.Link.extend({ joint.shapes.ice.WireView = joint.dia.LinkView.extend({ + initialize: function() { + joint.dia.LinkView.prototype.initialize.apply(this, arguments); + + var self = this; + setTimeout(function() { + var portName = self.model.get('source').port; + var rightPorts = self.sourceView.model.get('rightPorts'); + + // Initialize wire properties + var port; + for (var o in rightPorts) { + port = rightPorts[o]; + if (portName === port.id) { + self.model.attributes.size = port.size; // For wire size connection validation + self.$('.connection').css('stroke-width', (port.size > 1) ? 8 : 2); + self.model.label(0, {attrs: { text: { text: (port.size > 1) ? '' + port.size + '' : '' } } }); + self.model.bifurcationMarkup = self.model.bifurcationMarkup.replace(/<%= r %>/g, (port.size > 1) ? 8 : 4); + self.update(); + break; + } + } + }, 0); + }, + render: function() { joint.dia.LinkView.prototype.render.apply(this, arguments); // console.log('render'); @@ -768,15 +896,17 @@ joint.shapes.ice.WireView = joint.dia.LinkView.extend({ // Find all the wires in the same port var portWires = []; _.each(allWires, function(wire) { - if ((wire.attributes.source.id === currentWire.attributes.source.id) && - (wire.attributes.source.port === currentWire.attributes.source.port)) + var wireSource = wire.get('source'); + var cwireSource = currentWire.get('source'); + if ((wireSource.id === cwireSource.id) && + (wireSource.port === cwireSource.port)) { // Wire with the same source of currentWire var wireView = self.paper.findViewByModel(wire); // Clean the wire bifurcations var markerBifurcations = $(wireView._V.markerBifurcations.node).empty(); portWires.push({ - id: wire.attributes.id, + id: wire.get('id'), view: wireView, markers: markerBifurcations }); diff --git a/app/scripts/services/blocks.service.js b/app/scripts/services/blocks.service.js new file mode 100644 index 000000000..fff0cdcb6 --- /dev/null +++ b/app/scripts/services/blocks.service.js @@ -0,0 +1,735 @@ +'use strict'; + +angular.module('icestudio') + .service('blocks', function(joint, + boards, + utils, + gettextCatalog) { + var gridsize = 8; + + this.newBasic = newBasic; + this.newGeneric = newGeneric; + + this.loadBasic = loadBasic; + this.loadGeneric = loadGeneric; + this.loadWire = loadWire; + + this.editBasic = editBasic; + + + //-- New + + function newBasic(type, addCellCallback) { + switch(type) { + case 'basic.input': + case 'basic.output': + newBasicIO(type, addCellCallback); + break; + case 'basic.constant': + newBasicConstant(addCellCallback); + break; + case 'basic.code': + newBasicCode(addCellCallback); + break; + case 'basic.info': + newBasicInfo(addCellCallback); + break; + default: + break; + } + } + + function newBasicIO(type, addCellCallback) { + var config; + if (type === 'basic.input') { + config = { type: type, _default: 'in', x: 4 }; + } + else { // 'basic.output' + config = { type: type, _default: 'out', x: 95 }; + } + var blockInstance = { + id: null, + data: {}, + type: config.type, + position: { x: config.x * gridsize, y: 4 * gridsize } + }; + utils.inputcheckboxprompt([ + gettextCatalog.getString('Enter the ports'), + gettextCatalog.getString('Virtual port') + ], [ + config._default, + true + ], + function(evt, values) { + var labels = values[0].replace(/ /g, '').split(','); + var virtual = values[1]; + // Validate values + var portInfo, portInfos = []; + for (var l in labels) { + if (labels[l]) { + portInfo = utils.parsePortLabel(labels[l]); + if (portInfo) { + evt.cancel = false; + portInfos.push(portInfo); + } + else { + evt.cancel = true; + alertify.notify(gettextCatalog.getString('Wrong port name {{name}}', { name: labels[l] }), 'warning', 3); + return; + } + } + else { + evt.cancel = true; + //return; + } + } + // Create blocks + for (var p in portInfos) { + portInfo = portInfos[p]; + var pins = getPins(portInfo); + blockInstance.data = { + name: portInfo.name, + range: portInfo.rangestr, + pins: pins, + virtual: virtual + }; + if (addCellCallback) { + addCellCallback(loadBasic(blockInstance)); + } + // Next block position + blockInstance.position.y += (virtual ? 10 : (6 + 4 * pins.length)) * gridsize; + } + }); + } + + function getPins(portInfo) { + var pins = []; + if (portInfo.range) { + for (var r in portInfo.range) { + pins.push({ index: portInfo.range[r].toString(), name: '', value: '0' }); + } + } + else { + pins.push({ index: '0', name: '', value: '0' }); + } + return pins; + } + + function newBasicConstant(addCellCallback) { + var blockInstance = { + id: null, + data: {}, + type: 'basic.constant', + position: { x: 20 * gridsize, y: 4 * gridsize } + }; + utils.inputcheckboxprompt([ + gettextCatalog.getString('Enter the constant blocks'), + gettextCatalog.getString('Local parameter') + ], [ + 'C', + false + ], + function(evt, values) { + var labels = values[0].replace(/ /g, '').split(','); + var local = values[1]; + // Validate values + var paramInfo, paramInfos = []; + for (var l in labels) { + if (labels[l]) { + paramInfo = utils.parseParamLabel(labels[l]); + if (paramInfo) { + evt.cancel = false; + paramInfos.push(paramInfo); + } + else { + evt.cancel = true; + alertify.notify(gettextCatalog.getString('Wrong parameter name {{name}}', { name: labels[l] }), 'warning', 3); + return; + } + } + else { + evt.cancel = true; + //return; + } + } + // Create blocks + for (var p in paramInfos) { + paramInfo = paramInfos[p]; + blockInstance.data = { + name: paramInfo.name, + value: '', + local: local + }; + if (addCellCallback) { + addCellCallback(loadBasicConstant(blockInstance)); + } + blockInstance.position.x += 15 * gridsize; + } + }); + } + + function newBasicCode(addCellCallback, block) { + var blockInstance = { + id: null, + data: { + code: '', + params: [], + ports: { in: [], out: [] } + }, + type: 'basic.code', + position: { x: 31 * gridsize, y: 24 * gridsize } + }; + var defaultValues = [ + 'a , b', + 'c , d', + '' + ]; + if (block) { + blockInstance = block; + var index, port; + if (block.data.ports) { + var inPorts = []; + for (index in block.data.ports.in) { + port = block.data.ports.in[index]; + inPorts.push(port.name + (port.range ? port.range : '')); + } + defaultValues[0] = inPorts.join(' , '); + var outPorts = []; + for (index in block.data.ports.out) { + port = block.data.ports.out[index]; + outPorts.push(port.name + (port.range ? port.range : '')); + } + defaultValues[1] = outPorts.join(' , '); + } + if (block.data.params) { + var params = []; + for (index in block.data.params) { + params.push(block.data.params[index].name); + } + defaultValues[2] = params.join(' , '); + } + } + utils.multiprompt( + [ gettextCatalog.getString('Enter the input ports'), + gettextCatalog.getString('Enter the output ports'), + gettextCatalog.getString('Enter the parameters') ], + defaultValues, + function(evt, values) { + var inPorts = values[0].replace(/ /g, '').split(','); + var outPorts = values[1].replace(/ /g, '').split(','); + var params = values[2].replace(/ /g, '').split(','); + var allNames = []; + // Validate values + var i, inPortInfo, inPortInfos = []; + for (i in inPorts) { + if (inPorts[i]) { + inPortInfo = utils.parsePortLabel(inPorts[i]); + if (inPortInfo && inPortInfo.name) { + evt.cancel = false; + inPortInfos.push(inPortInfo); + } + else { + evt.cancel = true; + alertify.notify(gettextCatalog.getString('Wrong port name {{name}}', { name: inPorts[i] }), 'warning', 3); + return; + } + } + } + var o, outPortInfo, outPortInfos = []; + for (o in outPorts) { + if (outPorts[o]) { + outPortInfo = utils.parsePortLabel(outPorts[o]); + if (outPortInfo && outPortInfo.name) { + evt.cancel = false; + outPortInfos.push(outPortInfo); + } + else { + evt.cancel = true; + alertify.notify(gettextCatalog.getString('Wrong port name {{name}}', { name: outPorts[o] }), 'warning', 3); + return; + } + } + } + var p, paramInfo, paramInfos = []; + for (p in params) { + if (params[p]) { + paramInfo = utils.parseParamLabel(params[p]); + if (paramInfo) { + evt.cancel = false; + paramInfos.push(paramInfo); + } + else { + evt.cancel = true; + alertify.notify(gettextCatalog.getString('Wrong parameter name {{name}}', { name: params[p] }), 'warning', 3); + return; + } + } + } + // Create ports + var pins; + blockInstance.data.ports.in = []; + for (i in inPortInfos) { + if (inPortInfos[i]) { + pins = getPins(inPortInfos[i]); + blockInstance.data.ports.in.push({ + name: inPortInfos[i].name, + range: inPortInfos[i].rangestr, + size: pins.length + }); + allNames.push(inPortInfos[i].name); + } + } + blockInstance.data.ports.out = []; + for (o in outPortInfos) { + if (outPortInfos[o]) { + pins = getPins(outPortInfos[o]); + blockInstance.data.ports.out.push({ + name: outPortInfos[o].name, + range: outPortInfos[o].rangestr, + size: pins.length + }); + allNames.push(outPortInfos[o].name); + } + } + blockInstance.data.params = []; + for (p in paramInfos) { + if (paramInfos[p]) { + blockInstance.data.params.push({ + name: paramInfos[p].name + }); + allNames.push(paramInfos[p].name); + } + } + // Check duplicated attributes + var numNames = allNames.length; + if (numNames === $.unique(allNames).length) { + evt.cancel = false; + // Create block + if (addCellCallback) { + addCellCallback(loadBasicCode(blockInstance)); + } + } + else { + evt.cancel = true; + alertify.notify(gettextCatalog.getString('Duplicated block attributes'), 'warning', 3); + } + }); + } + + function newBasicInfo(addCellCallback) { + var blockInstance = { + id: null, + data: { info: '' }, + type: 'basic.info', + position: { x: 4 * gridsize, y: 30 * gridsize } + }; + if (addCellCallback) { + addCellCallback(loadBasicInfo(blockInstance)); + } + } + + function newGeneric(type, block, addCellCallback) { + var blockInstance = { + id: null, + type: type, + position: { x: 6 * gridsize, y: 16 * gridsize } + }; + if (block && + block.design && + block.design.graph && + block.design.graph.blocks && + block.design.graph.wires && + block.design.deps) { + if (addCellCallback) { + addCellCallback(loadGeneric(blockInstance, block)); + } + } + else { + alertify.notify(gettextCatalog.getString('Wrong block format: {{type}}', { type: type }), 'error', 30); + } + } + + + //-- Load + + function loadBasic(instance, disabled) { + switch(instance.type) { + case 'basic.input': + return loadBasicInput(instance, disabled); + case 'basic.output': + return loadBasicOutput(instance, disabled); + case 'basic.constant': + return loadBasicConstant(instance, disabled); + case 'basic.code': + return loadBasicCode(instance, disabled); + case 'basic.info': + return loadBasicInfo(instance, disabled); + default: + break; + } + } + + function loadBasicInput(instance, disabled) { + var rightPorts = [{ + id: 'out', + label: '', + size: instance.data.pins.length, + gridUnits: 8 + }]; + var cell = new joint.shapes.ice.Input({ + id: instance.id, + blockType: instance.type, + data: instance.data, + position: instance.position, + disabled: disabled, + rightPorts: rightPorts, + choices: boards.getPinoutHTML() + }); + return cell; + } + + function loadBasicOutput(instance, disabled) { + var leftPorts = [{ + id: 'in', + label: '', + size: instance.data.pins.length, + gridUnits: 8 + }]; + var cell = new joint.shapes.ice.Output({ + id: instance.id, + blockType: instance.type, + data: instance.data, + position: instance.position, + disabled: disabled, + leftPorts: leftPorts, + choices: boards.getPinoutHTML() + }); + return cell; + } + + function loadBasicConstant(instance, disabled) { + var bottomPorts = [{ + id: 'constant-out', + label: '', + gridUnits: 8 + }]; + var cell = new joint.shapes.ice.Constant({ + id: instance.id, + blockType: instance.type, + data: instance.data, + position: instance.position, + disabled: disabled, + bottomPorts: bottomPorts + }); + return cell; + } + + function loadBasicCode(instance, disabled) { + var port; + var leftPorts = []; + var rightPorts = []; + var topPorts = []; + + for (var i in instance.data.ports.in) { + port = instance.data.ports.in[i]; + leftPorts.push({ + id: port.name, + label: port.name + (port.range ? port.range : ''), + size: port.size, + gridUnits: 32 + }); + } + + for (var o in instance.data.ports.out) { + port = instance.data.ports.out[o]; + rightPorts.push({ + id: port.name, + label: port.name + (port.range ? port.range : ''), + size: port.size, + gridUnits: 32 + }); + } + + for (var p in instance.data.params) { + port = instance.data.params[p]; + topPorts.push({ + id: port.name, + label: port.name, + gridUnits: 48 + }); + } + + var cell = new joint.shapes.ice.Code({ + id: instance.id, + blockType: instance.type, + data: instance.data, + position: instance.position, + disabled: disabled, + leftPorts: leftPorts, + rightPorts: rightPorts, + topPorts: topPorts + }); + return cell; + } + + function loadBasicInfo(instance, disabled) { + var cell = new joint.shapes.ice.Info({ + id: instance.id, + blockType: instance.type, + data: instance.data, + position: instance.position, + disabled: disabled + }); + return cell; + } + + function loadGeneric(instance, block) { + var i; + var leftPorts = []; + var rightPorts = []; + var topPorts = []; + var bottomPorts = []; + var gridsize = 8; + + for (i in block.design.graph.blocks) { + var item = block.design.graph.blocks[i]; + if (item.type === 'basic.input') { + leftPorts.push({ + id: item.id, + label: item.data.name + (item.data.range ? item.data.range : ''), + size: block.design.graph.blocks[i].data.pins.length + }); + } + else if (item.type === 'basic.output') { + rightPorts.push({ + id: item.id, + label: item.data.name + (item.data.range ? item.data.range : ''), + size: block.design.graph.blocks[i].data.pins.length + }); + } + else if (item.type === 'basic.constant') { + if (!item.data.local) { + topPorts.push({ + id: item.id, + label: item.data.name + }); + } + } + } + + var numPortsHeight = Math.max(leftPorts.length, rightPorts.length); + var numPortsWidth = Math.max(topPorts.length, bottomPorts.length); + + var height = 8 * gridsize; + height = Math.max(4 * gridsize * numPortsHeight, height); + var blockLabel = instance.type.toUpperCase(); + var blockLabels = instance.type.split('.'); + var maxBlockLabel = ''; + var width = 12 * gridsize; + + for (var l in blockLabels) { + if (blockLabels[l].length > maxBlockLabel.length) { + maxBlockLabel = blockLabels[l]; + } + } + if (maxBlockLabel.length > 4) { + width = Math.min((maxBlockLabel.length + 8) * gridsize, 24 * gridsize); + } + width = Math.max(4 * gridsize * numPortsWidth, width); + + var gridUnitsHeight = height / gridsize; + var gridUnitsWidth = width / gridsize; + + for (i in leftPorts) { + leftPorts[i].gridUnits = gridUnitsHeight; + } + for (i in rightPorts) { + rightPorts[i].gridUnits = gridUnitsHeight; + } + for (i in topPorts) { + topPorts[i].gridUnits = gridUnitsWidth; + } + for (i in bottomPorts) { + bottomPorts[i].gridUnits = gridUnitsWidth; + } + + if (blockLabels.length > 1) { + blockLabel = blockLabels.join('
').toUpperCase(); + } + + var blockImage = ''; + if (block.package.image) { + width = 12 * gridsize; + if (block.package.image.startsWith('%3Csvg')) { + blockImage = block.package.image; + } + else if (block.package.image.startsWith('' + pinout[i].name + ''; + } + return code; + } + }); diff --git a/app/scripts/services/compiler.service.js b/app/scripts/services/compiler.service.js index ae135d599..c01e911b0 100644 --- a/app/scripts/services/compiler.service.js +++ b/app/scripts/services/compiler.service.js @@ -39,13 +39,13 @@ angular.module('icestudio') return header; } - function digestId(id, force) { - if (id.indexOf('-') !== -1 || force) { - return 'v' + nodeSha1(id).toString().substring(0, 6); - } - else { - return id.replace('.', '_'); - } + function digestId(id) { + if (id.indexOf('-') !== -1) { + return 'v' + nodeSha1(id).toString().substring(0, 6); + } + else { + return id.replace(/\./g, '_'); + } } function module(data) { @@ -61,13 +61,8 @@ angular.module('icestudio') var params = []; for (var p in data.params) { if (data.params[p] instanceof Object) { - // Generic block params.push(' parameter ' + data.params[p].name + ' = ' + (data.params[p].value ? data.params[p].value : '0')); } - else { - // Code block - params.push(' parameter ' + data.params[p] + ' = 0'); - } } if (params.length > 0) { @@ -80,10 +75,12 @@ angular.module('icestudio') var ports = []; for (var i in data.ports.in) { - ports.push(' input ' + data.ports.in[i]); + var _in = data.ports.in[i]; + ports.push(' input ' + (_in.range ? (_in.range + ' ') : '') + _in.name); } for (var o in data.ports.out) { - ports.push(' output ' + data.ports.out[o]); + var _out = data.ports.out[o]; + ports.push(' output ' + (_out.range ? (_out.range + ' ') : '') + _out.name); } if (ports.length > 0) { @@ -142,10 +139,16 @@ angular.module('icestudio') for (var i in graph.blocks) { var block = graph.blocks[i]; if (block.type === 'basic.input') { - ports.in.push(digestId(block.id)); + ports.in.push({ + name: digestId(block.id), + range: block.data.range ? block.data.range : '' + }); } else if (block.type === 'basic.output') { - ports.out.push(digestId(block.id)); + ports.out.push({ + name: digestId(block.id), + range: block.data.range ? block.data.range : '' + }); } } @@ -174,7 +177,8 @@ angular.module('icestudio') } else { // Wires - connections.wire.push('wire w' + w + ';'); + var range = wire.size ? ' [0:' + (wire.size-1) +'] ' : ' '; + connections.wire.push('wire' + range + 'w' + w + ';'); } // Assignations for (i in graph.blocks) { @@ -238,12 +242,13 @@ angular.module('icestudio') block.type !== 'basic.info') { // Header - - var id = digestId(block.type, true); + instance += name; if (block.type === 'basic.code') { - id += '_' + digestId(block.id); + instance += '_' + digestId(block.id); + } + else { + instance += '_' + digestId(block.type); } - instance += name + '_' + digestId(id); //-- Parameters @@ -323,10 +328,6 @@ angular.module('icestudio') var graph = project.design.graph; var deps = project.design.deps; - // Scape dot in name - - name = digestId(name); - // Main module if (name) { @@ -342,7 +343,7 @@ angular.module('icestudio') // Dependencies modules for (var d in deps) { - code += verilogCompiler(name + '_' + digestId(d, true), deps[d]); + code += verilogCompiler(name + '_' + digestId(d), deps[d]); } // Code modules @@ -352,7 +353,7 @@ angular.module('icestudio') if (block) { if (block.type === 'basic.code') { data = { - name: name + '_' + digestId(block.type, true) + '_' + digestId(block.id), + name: name + '_' + digestId(block.id), params: block.data.params, ports: block.data.ports, content: block.data.code @@ -374,11 +375,24 @@ angular.module('icestudio') var block = graph.blocks[i]; if (block.type === 'basic.input' || block.type === 'basic.output') { - code += 'set_io '; - code += digestId(block.id); - code += ' '; - code += block.data.pin.value; - code += '\n'; + + if (block.data.pins.length > 1) { + for (var p in block.data.pins) { + var pin = block.data.pins[p]; + code += 'set_io '; + code += digestId(block.id); + code += '[' + pin.index + '] '; + code += block.data.virtual ? '' : pin.value; + code += '\n'; + } + } + else { + code += 'set_io '; + code += digestId(block.id); + code += ' '; + code += block.data.virtual ? '' : block.data.pins[0].value; + code += '\n'; + } } } diff --git a/app/scripts/services/graph.service.js b/app/scripts/services/graph.service.js index 986026ff3..e270d347b 100644 --- a/app/scripts/services/graph.service.js +++ b/app/scripts/services/graph.service.js @@ -4,6 +4,7 @@ angular.module('icestudio') .service('graph', function($rootScope, joint, boards, + blocks, utils, gettextCatalog, nodeSha1) { @@ -63,9 +64,7 @@ angular.module('icestudio') this.breadcrumbs = [{ name: name }]; } this.breadcrumbs[0].name = name; - if(!$rootScope.$$phase) { - $rootScope.$apply(); - } + utils.rootScopeSafeApply(); }; this.createPaper = function(element) { @@ -113,8 +112,9 @@ angular.module('icestudio') return false; } } + var i; var links = graph.getLinks(); - for (var i in links) { + for (i in links) { var linkIView = links[i].findView(paper); if (linkView === linkIView) { //Skip the wire the user is drawing @@ -150,6 +150,24 @@ angular.module('icestudio') } return ret; } + // Prevent different size connections + var tsize; + var lsize = linkView.model.attributes.size; + var portId = magnetT.getAttribute('port'); + var tLeftPorts = cellViewT.model.attributes.leftPorts; + for (i in tLeftPorts) { + var port = tLeftPorts[i]; + if (portId === port.id) { + tsize = port.size; + break; + } + } + tsize = tsize || 1; + lsize = lsize || 1; + if (tsize !== lsize) { + warning(gettextCatalog.getString('Invalid connection: ' + lsize + ' → ' + tsize)); + return false; + } // Prevent loop links return magnetS !== magnetT; } @@ -276,72 +294,29 @@ angular.module('icestudio') }); paper.on('cell:pointerdblclick', function(cellView/*, evt, x, y*/) { - var data = cellView.model.attributes; - if (data.blockType === 'basic.input' || - data.blockType === 'basic.output') { - if (paper.options.enabled) { - alertify.prompt(gettextCatalog.getString('Update the port label'), data.data.label ? ' ' + data.data.label + ' ' : '', - function(evt, label) { - label = label.replace(/ /g, ''); - if (data.data.label !== label) { - data.data.label = label; - cellView.renderLabel(); - alertify.success(gettextCatalog.getString('Label updated')); - } - }); - } - } - else if (data.blockType === 'basic.constant') { - if (paper.options.enabled) { - utils.constantprompt([ - gettextCatalog.getString('Update the block label'), - gettextCatalog.getString('Update the block status'), - gettextCatalog.getString('Local parameter') - ], [ - data.data.label ? ' ' + data.data.label + ' ' : '', - data.data.local ? data.data.local : false - ], - function(evt, values) { - var label = values[0].replace(/ /g, ''); - if (data.data.label !== label) { - data.data.label = label; - cellView.renderLabel(); - alertify.success(gettextCatalog.getString('Label updated')); - } - var local = values[1]; - data.data.local = local; - cellView.renderLocal(); - }); - } - } - else if (data.blockType === 'basic.code') { + var type = cellView.model.attributes.blockType; + if (type.indexOf('basic.') !== -1) { if (paper.options.enabled) { - var block = { - data: { - code: self.getContent(cellView.model.id), - params: data.data.params, - ports: data.data.ports - }, - position: cellView.model.attributes.position - }; - self.createBlock('basic.code', block, function() { - cellView.model.remove(); + if (type === 'basic.code') { + var content = self.getContent(cellView.model.id); + cellView.model.attributes.data.code = content; + } + blocks.editBasic(type, cellView, function(cell) { + addCell(cell); }); } } - else if (data.type !== 'ice.Wire' && data.type !== 'ice.Info') { - self.breadcrumbs.push({ name: data.blockType }); - if(!$rootScope.$$phase) { - $rootScope.$apply(); - } + else { + self.breadcrumbs.push({ name: type }); + utils.rootScopeSafeApply(); zIndex = 1; if (self.breadcrumbs.length === 2) { $rootScope.$broadcast('updateProject', function() { - self.loadDesign(dependencies[data.blockType].design, true); + self.loadDesign(dependencies[type].design, true); }); } else { - self.loadDesign(dependencies[data.blockType].design, true); + self.loadDesign(dependencies[type].design, true); } } }); @@ -434,237 +409,17 @@ angular.module('icestudio') } }; - this.createBlock = function(type, block, callback) { - var blockInstance = { - id: null, - data: {}, - type: type, - position: { x: 4 * gridsize, y: 4 * gridsize } - }; - - if (type === 'basic.code') { - var defaultValues = [ - ' a , b ', - ' c , d ', - '' - ]; - if (block && block.data) { - if (block.data.ports) { - defaultValues[0] = ' ' + block.data.ports.in.join(' , ') + ' '; - defaultValues[1] = ' ' + block.data.ports.out.join(' , ') + ' '; - } - if (block.data.params) { - defaultValues[2] = ' ' + block.data.params.join(' , ') + ' '; - } - } - utils.multiprompt( - [ gettextCatalog.getString('Enter the input ports'), - gettextCatalog.getString('Enter the output ports'), - gettextCatalog.getString('Enter the parameters') ], - defaultValues, - function(evt, ports) { - if (ports && (ports[0].length || ports[1].length)) { - blockInstance.data = { - code: '', - params: [], - ports: { in: [], out: [] } - }; - // Parse ports - var inPorts = []; - var outPorts = []; - var params = []; - if (ports.length > 0) { - inPorts = ports[0].replace(/ /g, '').split(','); - } - if (ports.length > 1) { - outPorts = ports[1].replace(/ /g, '').split(','); - } - if (ports.length > 2) { - params = ports[2].replace(/ /g, '').split(','); - } - - for (var i in inPorts) { - if (inPorts[i]) { - blockInstance.data.ports.in.push(inPorts[i]); - } - } - for (var o in outPorts) { - if (outPorts[o]) { - blockInstance.data.ports.out.push(outPorts[o]); - } - } - for (var p in params) { - if (params[p]) { - blockInstance.data.params.push(params[p]); - } - } - blockInstance.position.x = 31 * gridsize; - blockInstance.position.y = 24 * gridsize; - - var allAttrs= inPorts.concat(outPorts, params); - var numAttrs = allAttrs.length; - - // Check duplicated attributes - if (numAttrs === $.unique(allAttrs).length) { - evt.cancel = false; - if (block) { - blockInstance.data.code = block.data.code; - blockInstance.position = block.position; - } - var cell = addBasicCodeBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - if (callback) { - callback(); - } - } - else { - evt.cancel = true; - alertify.notify(gettextCatalog.getString('Duplicated block attributes'), 'warning', 3); - } - } - }); - } - else if (type === 'basic.info') { - blockInstance.data = { - info: '' - }; - blockInstance.position.y = 30 * gridsize; - var cell = addBasicInfoBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - } - else if (type === 'basic.input') { - alertify.prompt(gettextCatalog.getString('Enter the input ports'), ' in ', - function(evt, name) { - if (name) { - var names = name.replace(/ /g, '').split(','); - for (var n in names) { - if (names[n]) { - blockInstance.data = { - label: names[n], - pin: { - name: '', - value: 0 - } - }; - var cell = addBasicInputBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - blockInstance.position.y += 10 * gridsize; - } - } - } - else { - /*blockInstance.data = { - label: '', - pin: { - name: '', - value: 0 - } - }; - var cell = addBasicInputBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - blockInstance.position.y += 10 * gridsize;*/ - } - }); - } - else if (type === 'basic.output') { - alertify.prompt(gettextCatalog.getString('Enter the output ports'), ' out ', - function(evt, name) { - if (name) { - var names = name.replace(/ /g, '').split(','); - blockInstance.position.x = 95 * gridsize; - for (var n in names) { - if (names[n]) { - blockInstance.data = { - label: names[n], - pin: { - name: '', - value: 0 - } - }; - var cell = addBasicOutputBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - blockInstance.position.y += 10 * gridsize; - } - } - } - else { - /*blockInstance.position.x = 95 * gridsize; - blockInstance.data = { - label: '', - pin: { - name: '', - value: 0 - } - }; - var cell = addBasicOutputBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - blockInstance.position.y += 10 * gridsize;*/ - } - }); - } - else if (type === 'basic.constant') { - alertify.prompt(gettextCatalog.getString('Enter the constant blocks'), ' C ', - function(evt, name) { - if (name) { - var names = name.replace(/ /g, '').split(','); - blockInstance.position.x = 20 * gridsize; - for (var n in names) { - if (names[n]) { - blockInstance.data = { - label: names[n], - local: false, - value: '' - }; - var cell = addBasicConstantBlock(blockInstance); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - blockInstance.position.x += 15 * gridsize; - } - } - } - else { - } + this.createBlock = function(type, block) { + if (type.indexOf('basic.') !== -1) { + blocks.newBasic(type, function(cell) { + addCell(cell); }); } else { - if (block && - block.design && - block.design.graph && - block.design.graph.blocks && - block.design.graph.wires && - block.design.deps) { - dependencies[type] = block; - blockInstance.position.x = 6 * gridsize; - blockInstance.position.y = 16 * gridsize; - var _cell = addGenericBlock(blockInstance, block); - var _cellView = paper.findViewByModel(_cell); - if (_cellView.$box.css('z-index') < zIndex) { - _cellView.$box.css('z-index', ++zIndex); - } - } - else { - alertify.notify(gettextCatalog.getString('Wrong block format: {{type}}', { type: type }), 'error', 30); - } + dependencies[type] = block; + blocks.newGeneric(type, block, function(cell) { + addCell(cell); + }); } }; @@ -691,8 +446,9 @@ angular.module('icestudio') for (var i in cells) { var cell = cells[i]; var type = cell.attributes.blockType; - if (type === 'basic.input' || type === 'basic.output') { - cell.attributes.choices = boards.getPinout(); + if (type === 'basic.input' || + type === 'basic.output') { + cell.attributes.choices = boards.getPinoutHTML(); var view = paper.findViewByModel(cell.id); view.renderChoices(); view.clearValue(); @@ -718,10 +474,6 @@ angular.module('icestudio') if (type.indexOf('config.') !== -1) { paper.findViewByModel(newCell).$box.addClass('config-block'); } - var cellView = paper.findViewByModel(newCell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } selection.reset(selection.without(cell)); selectionView.cancelSelection(); }); @@ -789,39 +541,31 @@ angular.module('icestudio') this.setState(design.state); setTimeout(function() { + var cell; // Blocks for (i in blockInstances) { var blockInstance = blockInstances[i]; - if (blockInstance.type === 'basic.code') { - addBasicCodeBlock(blockInstance, disabled); - } - else if (blockInstance.type === 'basic.info') { - addBasicInfoBlock(blockInstance, disabled); - } - else if (blockInstance.type === 'basic.input') { - addBasicInputBlock(blockInstance, disabled); - } - else if (blockInstance.type === 'basic.output') { - addBasicOutputBlock(blockInstance, disabled); - } - else if (blockInstance.type === 'basic.constant') { - addBasicConstantBlock(blockInstance, disabled); + if (blockInstance.type.indexOf('basic.') !== -1) { + cell = blocks.loadBasic(blockInstance, disabled); } else { if (deps && deps[blockInstance.type]) { - addGenericBlock(blockInstance, deps[blockInstance.type]); + cell = blocks.loadGeneric(blockInstance, deps[blockInstance.type]); } } + addCell(cell); } // Wires for (i in wires) { - addWire(wires[i]); + var source = graph.getCell(wires[i].source.block); + var target = graph.getCell(wires[i].target.block); + cell = blocks.loadWire(wires[i], source, target); + addCell(cell); } self.appEnable(!disabled); - $('body').removeClass('waiting'); if (callback) { @@ -834,260 +578,18 @@ angular.module('icestudio') } }; - this.importBlock = function(type, block) { - var blockInstance = { - id: null, - data: {}, - type: type, - position: { x: 6 * gridsize, y: 16 * gridsize } - }; - dependencies[type] = block; - var cell = addGenericBlock(blockInstance, block); - var cellView = paper.findViewByModel(cell); - if (cellView.$box.css('z-index') < zIndex) { - cellView.$box.css('z-index', ++zIndex); - } - }; - - function addBasicInputBlock(blockInstances, disabled) { - var cell = new joint.shapes.ice.Input({ - id: blockInstances.id, - blockType: blockInstances.type, - data: blockInstances.data, - label: blockInstances.data.label, - position: blockInstances.position, - disabled: disabled, - choices: boards.getPinout() - }); - - addCell(cell); - return cell; - } - - function addBasicOutputBlock(blockInstances, disabled) { - var cell = new joint.shapes.ice.Output({ - id: blockInstances.id, - blockType: blockInstances.type, - data: blockInstances.data, - label: blockInstances.data.label, - position: blockInstances.position, - disabled: disabled, - choices: boards.getPinout() - }); - - addCell(cell); - return cell; - } - - function addBasicConstantBlock(blockInstances, disabled) { - var cell = new joint.shapes.ice.Constant({ - id: blockInstances.id, - blockType: blockInstances.type, - data: blockInstances.data, - label: blockInstances.data.label, - position: blockInstances.position, - disabled: disabled - }); - - addCell(cell); - return cell; - } - - function addBasicCodeBlock(blockInstances, disabled) { - var leftPorts = []; - var rightPorts = []; - var topPorts = []; - - for (var i in blockInstances.data.ports.in) { - leftPorts.push({ - id: blockInstances.data.ports.in[i], - label: blockInstances.data.ports.in[i], - gridUnits: 32 - }); - } - - for (var o in blockInstances.data.ports.out) { - rightPorts.push({ - id: blockInstances.data.ports.out[o], - label: blockInstances.data.ports.out[o], - gridUnits: 32 - }); - } - - for (var p in blockInstances.data.params) { - topPorts.push({ - id: blockInstances.data.params[p], - label: blockInstances.data.params[p], - gridUnits: 48 - }); - } - - var cell = new joint.shapes.ice.Code({ - id: blockInstances.id, - blockType: blockInstances.type, - data: blockInstances.data, - position: blockInstances.position, - disabled: disabled, - leftPorts: leftPorts, - rightPorts: rightPorts, - topPorts: topPorts - }); - - addCell(cell); - return cell; - } - - function addBasicInfoBlock(blockInstances, disabled) { - var cell = new joint.shapes.ice.Info({ - id: blockInstances.id, - blockType: blockInstances.type, - data: blockInstances.data, - position: blockInstances.position, - disabled: disabled - }); - - addCell(cell); - return cell; - } - - function addGenericBlock(blockInstance, block) { - var i; - var leftPorts = []; - var rightPorts = []; - var topPorts = []; - var bottomPorts = []; - - for (i in block.design.graph.blocks) { - var item = block.design.graph.blocks[i]; - if (item.type === 'basic.input') { - leftPorts.push({ - id: item.id, - label: item.data.label - }); - } - else if (item.type === 'basic.output') { - rightPorts.push({ - id: item.id, - label: item.data.label - }); - } - else if (item.type === 'basic.constant') { - if (!item.data.local) { - topPorts.push({ - id: item.id, - label: item.data.label - }); - } - } - } - - var numPortsHeight = Math.max(leftPorts.length, rightPorts.length); - var numPortsWidth = Math.max(topPorts.length, bottomPorts.length); - - var height = 8 * gridsize; - height = Math.max(4 * gridsize * numPortsHeight, height); - var blockLabel = blockInstance.type.toUpperCase(); - var width = 12 * gridsize; - if (blockLabel.length > 4) { - width = Math.min((blockLabel.length + 8) * gridsize, 24 * gridsize); - } - width = Math.max(4 * gridsize * numPortsWidth, width); - - var gridUnitsHeight = height / gridsize; - var gridUnitsWidth = width / gridsize; - - for (i in leftPorts) { - leftPorts[i].gridUnits = gridUnitsHeight; - } - for (i in rightPorts) { - rightPorts[i].gridUnits = gridUnitsHeight; - } - for (i in topPorts) { - topPorts[i].gridUnits = gridUnitsWidth; - } - for (i in bottomPorts) { - bottomPorts[i].gridUnits = gridUnitsWidth; - } - - if (blockInstance.type.indexOf('.') !== -1) { - blockLabel = blockInstance.type.split('.').join(' '); - } - - var blockImage = ''; - if (block.package.image) { - width = 12 * gridsize; - if (block.package.image.startsWith('%3Csvg')) { - blockImage = block.package.image; - } - else if (block.package.image.startsWith(' 1) { + wire.size = cell.size; + } wire.vertices = cell.vertices; wires.push(wire); } diff --git a/app/scripts/services/utils.service.js b/app/scripts/services/utils.service.js index d08a0578d..e083c52b3 100644 --- a/app/scripts/services/utils.service.js +++ b/app/scripts/services/utils.service.js @@ -633,16 +633,13 @@ angular.module('icestudio') }); }; - this.constantprompt = function(messages, values, callback) { + this.inputcheckboxprompt = function(messages, values, callback) { var content = []; content.push('
'); content.push('

' + messages[0] + '

'); - content.push(' '); + content.push(' '); content.push('
'); - content.push('

' + messages[1] + '

'); - content.push('
    '); - content.push('
  • ' + messages[2] + '

  • '); - content.push('
'); + content.push('
'); content.push('
'); // Restore values $('#label').val(values[0]); @@ -869,4 +866,37 @@ angular.module('icestudio') } }; + this.parsePortLabel = function(data) { + // e.g: name[x:y] + var match, ret = {}; + var pattern = /([A-Za-z_]+[A-Za-z_0-9]*){0,1}(\[([0-9]+):([0-9]+)\]){0,1}/g; + match = pattern.exec(data); + if (match && (match[0] === match.input)) { + ret.name = match[1] ? match[1] : ''; + ret.rangestr = match[2]; + if (match[2]) { + if (match[3] > match[4]) { + ret.range = _.range(match[3], parseInt(match[4])-1, -1); + } + else { + ret.range = _.range(match[3], parseInt(match[4])+1, +1); + } + } + return ret; + } + return null; + }; + + this.parseParamLabel = function(data) { + // e.g: name + var match, ret = {}; + var pattern = /([A-Za-z_]+[A-Za-z_0-9]*){0,1}/g; + match = pattern.exec(data); + if (match && (match[0] === match.input)) { + ret.name = match[1] ? match[1] : ''; + return ret; + } + return null; + }; + }); diff --git a/app/styles/project.css b/app/styles/design.css similarity index 87% rename from app/styles/project.css rename to app/styles/design.css index 1ed356620..f3cbba2d0 100644 --- a/app/styles/project.css +++ b/app/styles/design.css @@ -104,9 +104,9 @@ color: #444; } -.io-block { +.virtual-port { position: absolute; - background: #fafacd; + background: #E2FBC9; border-radius: 5px; border: 2px solid #888; pointer-events: none; @@ -115,25 +115,61 @@ z-index: 0; } -.io-block label { +.virtual-port label { display: block; - margin-top: 4px; + margin-top: 20px; text-align: center; font-size: 1em; color: #444; } -.io-block .select2 { +.fpga-port { position: absolute; - left: 5px; - bottom: 5px; + background: #FBFBC9; + border-radius: 5px; + border: 2px solid #888; + pointer-events: none; + -webkit-user-select: none; + user-select: none; + z-index: 0; +} + +.fpga-port label { + display: block; + margin-top: 3px; + margin-bottom: 4px; + text-align: center; + font-size: 1em; + color: #444; +} + +.fpga-port div p { + position: relative; + top: 0px; + left: -20px; + float: left; +} + +.fpga-port div .select2 { + position: relative; width: 82px; + left: 5px; + margin-bottom: 4px; pointer-events: auto; } +.select2-selection__rendered { + font-size: 13px; +} + +.bigdrop { + width: 92px !important; + font-size: 13px; +} + .constant-block { position: absolute; - background: #faeaaf; + background: #FBF0C9; border-radius: 5px; border: 2px solid #888; pointer-events: none; @@ -164,6 +200,7 @@ left: 5px; bottom: 5px; width: 82px; + font-size: 13px; pointer-events: auto; } diff --git a/app/styles/main.css b/app/styles/main.css index 2f7bdd540..dd51c137c 100644 --- a/app/styles/main.css +++ b/app/styles/main.css @@ -26,11 +26,11 @@ body { cursor: progress; } -.alertify-notifier .ajs-right { +.alertify-notifier.ajs-right { bottom: 45px; } -.alertify-notifier .ajs-bottom { +.alertify-notifier.ajs-bottom { bottom: 45px; } diff --git a/app/views/menu.html b/app/views/menu.html index 52777f30c..83dccb4a4 100644 --- a/app/views/menu.html +++ b/app/views/menu.html @@ -7,7 +7,7 @@ - + diff --git a/demo/block.iceb b/demo/block.iceb deleted file mode 100644 index 95e911752..000000000 --- a/demo/block.iceb +++ /dev/null @@ -1,114 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 45.83406713517239, - "y": 43.306661649315814 - }, - "zoom": 0.8527620016280335 - }, - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 360, - "y": 8 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "out" - }, - "position": { - "x": 712, - "y": 264 - } - }, - { - "id": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [ - "i" - ], - "out": [ - "o" - ] - } - }, - "position": { - "x": 216, - "y": 168 - } - }, - { - "id": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f", - "type": "basic.input", - "data": { - "label": "in" - }, - "position": { - "x": 24, - "y": 264 - } - }, - { - "id": "9051bd8c-0c39-4b19-bb08-71ac0ba8e9bf", - "type": "basic.input", - "data": { - "label": "" - }, - "position": { - "x": 24, - "y": 360 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "v" - } - }, - { - "source": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - }, - { - "source": { - "block": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f", - "port": "out" - }, - "target": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "i" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/complex.ice b/demo/complex.ice deleted file mode 100644 index 3daa7d18e..000000000 --- a/demo/complex.ice +++ /dev/null @@ -1,333 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "1aa80d81-052d-426d-a073-a6e9678a9959", - "type": "block", - "data": {}, - "position": { - "x": 280, - "y": 264 - } - }, - { - "id": "e55fa1d9-ac88-461c-b5c1-4f4302c547cc", - "type": "block", - "data": {}, - "position": { - "x": 536, - "y": 280 - } - }, - { - "id": "1ffad532-f6da-47b0-8e85-d27fdcc211a8", - "type": "basic.input", - "data": { - "label": "in", - "pin": { - "name": "SW1", - "value": "10" - } - }, - "position": { - "x": 48, - "y": 248 - } - }, - { - "id": "3e7df107-03ee-4c35-9e52-607770f4c832", - "type": "basic.output", - "data": { - "label": "a", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 216, - "y": 80 - } - }, - { - "id": "083f6679-313b-497a-b2f0-4d972bc3cffa", - "type": "basic.output", - "data": { - "label": "c", - "pin": { - "name": "LED2", - "value": "97" - } - }, - "position": { - "x": 760, - "y": 144 - } - }, - { - "id": "8631a189-f5ed-4be1-88df-30d6acb97f99", - "type": "basic.output", - "data": { - "label": "d", - "pin": { - "name": "LED3", - "value": "98" - } - }, - "position": { - "x": 768, - "y": 280 - } - }, - { - "id": "365fa313-f3c1-433d-9d51-97429dfaa3c8", - "type": "basic.constant", - "data": { - "label": "Value", - "value": "1'b1" - }, - "position": { - "x": 344, - "y": 80 - } - } - ], - "wires": [ - { - "source": { - "block": "1ffad532-f6da-47b0-8e85-d27fdcc211a8", - "port": "out" - }, - "target": { - "block": "1aa80d81-052d-426d-a073-a6e9678a9959", - "port": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f" - } - }, - { - "source": { - "block": "1aa80d81-052d-426d-a073-a6e9678a9959", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "e55fa1d9-ac88-461c-b5c1-4f4302c547cc", - "port": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f" - } - }, - { - "source": { - "block": "1aa80d81-052d-426d-a073-a6e9678a9959", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "1aa80d81-052d-426d-a073-a6e9678a9959", - "port": "9051bd8c-0c39-4b19-bb08-71ac0ba8e9bf" - }, - "vertices": [ - { - "x": 288, - "y": 352 - } - ] - }, - { - "source": { - "block": "1ffad532-f6da-47b0-8e85-d27fdcc211a8", - "port": "out" - }, - "target": { - "block": "3e7df107-03ee-4c35-9e52-607770f4c832", - "port": "in" - }, - "vertices": [] - }, - { - "source": { - "block": "365fa313-f3c1-433d-9d51-97429dfaa3c8", - "port": "constant-out" - }, - "target": { - "block": "1aa80d81-052d-426d-a073-a6e9678a9959", - "port": "386bc685-d806-4487-bece-b442b8c8689c" - }, - "vertices": [] - }, - { - "source": { - "block": "365fa313-f3c1-433d-9d51-97429dfaa3c8", - "port": "constant-out" - }, - "target": { - "block": "e55fa1d9-ac88-461c-b5c1-4f4302c547cc", - "port": "386bc685-d806-4487-bece-b442b8c8689c" - } - }, - { - "source": { - "block": "e55fa1d9-ac88-461c-b5c1-4f4302c547cc", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "083f6679-313b-497a-b2f0-4d972bc3cffa", - "port": "in" - }, - "vertices": [ - { - "x": 680, - "y": 256 - } - ] - }, - { - "source": { - "block": "e55fa1d9-ac88-461c-b5c1-4f4302c547cc", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "8631a189-f5ed-4be1-88df-30d6acb97f99", - "port": "in" - } - }, - { - "source": { - "block": "1ffad532-f6da-47b0-8e85-d27fdcc211a8", - "port": "out" - }, - "target": { - "block": "e55fa1d9-ac88-461c-b5c1-4f4302c547cc", - "port": "9051bd8c-0c39-4b19-bb08-71ac0ba8e9bf" - }, - "vertices": [ - { - "x": 200, - "y": 400 - } - ] - } - ] - }, - "deps": { - "block": { - "image": "", - "state": { - "pan": { - "x": 45.83406713517239, - "y": 43.306661649315814 - }, - "zoom": 0.8527620016280335 - }, - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 360, - "y": 8 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "out" - }, - "position": { - "x": 712, - "y": 264 - } - }, - { - "id": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [ - "i" - ], - "out": [ - "o" - ] - } - }, - "position": { - "x": 216, - "y": 168 - } - }, - { - "id": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f", - "type": "basic.input", - "data": { - "label": "in" - }, - "position": { - "x": 24, - "y": 264 - } - }, - { - "id": "9051bd8c-0c39-4b19-bb08-71ac0ba8e9bf", - "type": "basic.input", - "data": { - "label": "" - }, - "position": { - "x": 24, - "y": 360 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "v" - } - }, - { - "source": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - }, - { - "source": { - "block": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f", - "port": "out" - }, - "target": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "i" - } - } - ] - }, - "deps": {} - } - } -} \ No newline at end of file diff --git a/demo/constant-code-block.ice b/demo/constant-code-block.ice deleted file mode 100644 index ad9b38df3..000000000 --- a/demo/constant-code-block.ice +++ /dev/null @@ -1,85 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 0.9999999748467205 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 280, - "y": 48 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 624, - "y": 288 - } - }, - { - "id": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [], - "out": [ - "o" - ] - } - }, - "position": { - "x": 136, - "y": 192 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "v" - } - }, - { - "source": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/constant-code-block.iceb b/demo/constant-code-block.iceb deleted file mode 100644 index 75e086e23..000000000 --- a/demo/constant-code-block.iceb +++ /dev/null @@ -1,80 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - }, - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 280, - "y": 48 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "led" - }, - "position": { - "x": 624, - "y": 288 - } - }, - { - "id": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [], - "out": [ - "o" - ] - } - }, - "position": { - "x": 136, - "y": 192 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "v" - } - }, - { - "source": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/constant-generic-block.ice b/demo/constant-generic-block.ice deleted file mode 100644 index 1dc630eb6..000000000 --- a/demo/constant-generic-block.ice +++ /dev/null @@ -1,155 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": -21, - "y": 66 - }, - "zoom": 1 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "eb6dddea-3a81-4e26-ab7d-ed107b3676c9", - "type": "constant-code-block", - "data": {}, - "position": { - "x": 248, - "y": 184 - } - }, - { - "id": "3ea55b72-cda0-4f43-886b-e225b00229a4", - "type": "basic.constant", - "data": { - "label": "Value", - "value": "1'b1" - }, - "position": { - "x": 296, - "y": 32 - } - }, - { - "id": "06bd1d14-7302-4dd7-9e95-650d1070a203", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 536, - "y": 184 - } - } - ], - "wires": [ - { - "source": { - "block": "3ea55b72-cda0-4f43-886b-e225b00229a4", - "port": "constant-out" - }, - "target": { - "block": "eb6dddea-3a81-4e26-ab7d-ed107b3676c9", - "port": "386bc685-d806-4487-bece-b442b8c8689c" - } - }, - { - "source": { - "block": "eb6dddea-3a81-4e26-ab7d-ed107b3676c9", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "06bd1d14-7302-4dd7-9e95-650d1070a203", - "port": "in" - } - } - ] - }, - "deps": { - "constant-code-block": { - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - }, - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 280, - "y": 48 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "led" - }, - "position": { - "x": 624, - "y": 288 - } - }, - { - "id": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [], - "out": [ - "o" - ] - } - }, - "position": { - "x": 136, - "y": 192 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "v" - } - }, - { - "source": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - } - ] - }, - "deps": {} - } - } -} \ No newline at end of file diff --git a/demo/constant-io-code-block.ice b/demo/constant-io-code-block.ice deleted file mode 100644 index 819b5de0e..000000000 --- a/demo/constant-io-code-block.ice +++ /dev/null @@ -1,127 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 45.83406713517239, - "y": 43.306661649315814 - }, - "zoom": 0.8527620016280335 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 360, - "y": 8 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 712, - "y": 264 - } - }, - { - "id": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [ - "i" - ], - "out": [ - "o" - ] - } - }, - "position": { - "x": 216, - "y": 168 - } - }, - { - "id": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f", - "type": "basic.input", - "data": { - "label": "in", - "pin": { - "name": "SW1", - "value": "10" - } - }, - "position": { - "x": 24, - "y": 264 - } - }, - { - "id": "9051bd8c-0c39-4b19-bb08-71ac0ba8e9bf", - "type": "basic.input", - "data": { - "label": "", - "pin": { - "name": "", - "value": 0 - } - }, - "position": { - "x": 24, - "y": 360 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "v" - } - }, - { - "source": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - }, - { - "source": { - "block": "a8faca21-4b86-4bb1-8cd1-8c5252d4038f", - "port": "out" - }, - "target": { - "block": "ec9b901f-4cda-4f53-81ae-bfd74a0f0ae6", - "port": "i" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/div.ice b/demo/div.ice deleted file mode 100644 index 531e8b8f8..000000000 --- a/demo/div.ice +++ /dev/null @@ -1,112 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 3, - "y": 145 - }, - "zoom": 1 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "5e63bca8-458e-4d7a-ae46-dc2e457fdbf7", - "type": "basic.input", - "data": { - "label": "clk", - "pin": { - "name": "CLK", - "value": "21" - } - }, - "position": { - "x": 64, - "y": 152 - } - }, - { - "id": "400c2d1d-bce3-4d7a-8ab9-078bd072e1b7", - "type": "basic.output", - "data": { - "label": "", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 752, - "y": 152 - } - }, - { - "id": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "type": "basic.code", - "data": { - "code": "// Div 12MHz / M\n\nlocalparam N = $clog2(M);\n\nreg [N-1:0] c = 0;\n\nalways @(posedge clk_in)\n c <= (c == M - 1) ? 0 : c + 1;\n\nassign clk_out = c[N-1];", - "params": [ - "M" - ], - "ports": { - "in": [ - "clk_in" - ], - "out": [ - "clk_out" - ] - } - }, - "position": { - "x": 248, - "y": 56 - } - }, - { - "id": "4aba74c5-d08d-4d91-9401-099c6aeceb64", - "type": "basic.constant", - "data": { - "label": "M", - "value": "12000000" - }, - "position": { - "x": 392, - "y": -104 - } - } - ], - "wires": [ - { - "source": { - "block": "5e63bca8-458e-4d7a-ae46-dc2e457fdbf7", - "port": "out" - }, - "target": { - "block": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "port": "clk_in" - } - }, - { - "source": { - "block": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "port": "clk_out" - }, - "target": { - "block": "400c2d1d-bce3-4d7a-8ab9-078bd072e1b7", - "port": "in" - } - }, - { - "source": { - "block": "4aba74c5-d08d-4d91-9401-099c6aeceb64", - "port": "constant-out" - }, - "target": { - "block": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "port": "M" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/div.iceb b/demo/div.iceb deleted file mode 100644 index 1e66a8203..000000000 --- a/demo/div.iceb +++ /dev/null @@ -1,103 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 3, - "y": 145 - }, - "zoom": 1 - }, - "graph": { - "blocks": [ - { - "id": "5e63bca8-458e-4d7a-ae46-dc2e457fdbf7", - "type": "basic.input", - "data": { - "label": "clk" - }, - "position": { - "x": 64, - "y": 152 - } - }, - { - "id": "400c2d1d-bce3-4d7a-8ab9-078bd072e1b7", - "type": "basic.output", - "data": { - "label": "" - }, - "position": { - "x": 752, - "y": 152 - } - }, - { - "id": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "type": "basic.code", - "data": { - "code": "// Div 12MHz / M\n\nlocalparam N = $clog2(M);\n\nreg [N-1:0] c = 0;\n\nalways @(posedge clk_in)\n c <= (c == M - 1) ? 0 : c + 1;\n\nassign clk_out = c[N-1];", - "params": [ - "M" - ], - "ports": { - "in": [ - "clk_in" - ], - "out": [ - "clk_out" - ] - } - }, - "position": { - "x": 248, - "y": 56 - } - }, - { - "id": "4aba74c5-d08d-4d91-9401-099c6aeceb64", - "type": "basic.constant", - "data": { - "label": "M", - "value": "12000000" - }, - "position": { - "x": 392, - "y": -104 - } - } - ], - "wires": [ - { - "source": { - "block": "5e63bca8-458e-4d7a-ae46-dc2e457fdbf7", - "port": "out" - }, - "target": { - "block": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "port": "clk_in" - } - }, - { - "source": { - "block": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "port": "clk_out" - }, - "target": { - "block": "400c2d1d-bce3-4d7a-8ab9-078bd072e1b7", - "port": "in" - } - }, - { - "source": { - "block": "4aba74c5-d08d-4d91-9401-099c6aeceb64", - "port": "constant-out" - }, - "target": { - "block": "a2836617-8c44-4f54-9d1f-f2681c18db26", - "port": "M" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/input-output.ice b/demo/input-output.ice deleted file mode 100644 index 285925bc1..000000000 --- a/demo/input-output.ice +++ /dev/null @@ -1,58 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "f4405019-32a9-4f31-8e42-441c85f1959c", - "type": "basic.input", - "data": { - "label": "in", - "pin": { - "name": "SW1", - "value": "10" - } - }, - "position": { - "x": 104, - "y": 112 - } - }, - { - "id": "ef08c4f3-94b9-4e85-9fe7-78bc2a376c72", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 344, - "y": 112 - } - } - ], - "wires": [ - { - "source": { - "block": "f4405019-32a9-4f31-8e42-441c85f1959c", - "port": "out" - }, - "target": { - "block": "ef08c4f3-94b9-4e85-9fe7-78bc2a376c72", - "port": "in" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/demo/multi-block-block.ice b/demo/multi-block-block.ice deleted file mode 100644 index 46e49a468..000000000 --- a/demo/multi-block-block.ice +++ /dev/null @@ -1,219 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1.000000007072795 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "type": "basic.input", - "data": { - "label": "in", - "pin": { - "name": "SW1", - "value": "10" - } - }, - "position": { - "x": 96, - "y": 128 - } - }, - { - "id": "7625149d-3511-4d95-8405-a100409a5d42", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED1", - "value": "96" - } - }, - "position": { - "x": 632, - "y": 208 - } - }, - { - "id": "c39221a3-87dd-4524-9f65-879112b27f51", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 632, - "y": 64 - } - }, - { - "id": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "type": "logic.gate.not", - "data": {}, - "position": { - "x": 272, - "y": 128 - } - }, - { - "id": "2f906ce2-8c79-49e9-abbb-7141484a9ba9", - "type": "logic.gate.not", - "data": {}, - "position": { - "x": 448, - "y": 64 - } - }, - { - "id": "870693a6-da68-41e8-880c-3defad4b7dde", - "type": "logic.gate.not", - "data": {}, - "position": { - "x": 448, - "y": 208 - } - } - ], - "wires": [ - { - "source": { - "block": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "port": "out" - }, - "target": { - "block": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "port": "18c2ebc7-5152-439c-9b3f-851c59bac834" - } - }, - { - "source": { - "block": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" - }, - "target": { - "block": "2f906ce2-8c79-49e9-abbb-7141484a9ba9", - "port": "18c2ebc7-5152-439c-9b3f-851c59bac834" - } - }, - { - "source": { - "block": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" - }, - "target": { - "block": "870693a6-da68-41e8-880c-3defad4b7dde", - "port": "18c2ebc7-5152-439c-9b3f-851c59bac834" - } - }, - { - "source": { - "block": "2f906ce2-8c79-49e9-abbb-7141484a9ba9", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" - }, - "target": { - "block": "c39221a3-87dd-4524-9f65-879112b27f51", - "port": "in" - } - }, - { - "source": { - "block": "870693a6-da68-41e8-880c-3defad4b7dde", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" - }, - "target": { - "block": "7625149d-3511-4d95-8405-a100409a5d42", - "port": "in" - } - } - ] - }, - "deps": { - "logic.gate.not": { - "graph": { - "blocks": [ - { - "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", - "type": "basic.input", - "data": { - "label": "" - }, - "position": { - "x": 64, - "y": 144 - } - }, - { - "id": "664caf9e-5f40-4df4-800a-b626af702e62", - "type": "basic.output", - "data": { - "label": "" - }, - "position": { - "x": 752, - "y": 144 - } - }, - { - "id": "5365ed8c-e5db-4445-938f-8d689830ea5c", - "type": "basic.code", - "data": { - "code": "// NOT logic gate\n\nassign c = ~ a;", - "ports": { - "in": [ - "a" - ], - "out": [ - "c" - ] - } - }, - "position": { - "x": 256, - "y": 48 - } - } - ], - "wires": [ - { - "source": { - "block": "18c2ebc7-5152-439c-9b3f-851c59bac834", - "port": "out" - }, - "target": { - "block": "5365ed8c-e5db-4445-938f-8d689830ea5c", - "port": "a" - } - }, - { - "source": { - "block": "5365ed8c-e5db-4445-938f-8d689830ea5c", - "port": "c" - }, - "target": { - "block": "664caf9e-5f40-4df4-800a-b626af702e62", - "port": "in" - } - } - ] - }, - "deps": {}, - "image": "resources/images/not.svg", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - } - } - } -} \ No newline at end of file diff --git a/demo/multi-block-output.ice b/demo/multi-block-output.ice deleted file mode 100644 index f8e40e690..000000000 --- a/demo/multi-block-output.ice +++ /dev/null @@ -1,181 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1.000000007072795 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "type": "basic.input", - "data": { - "label": "in", - "pin": { - "name": "SW1", - "value": "10" - } - }, - "position": { - "x": 96, - "y": 120 - } - }, - { - "id": "7625149d-3511-4d95-8405-a100409a5d42", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED1", - "value": "96" - } - }, - "position": { - "x": 464, - "y": 208 - } - }, - { - "id": "c39221a3-87dd-4524-9f65-879112b27f51", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 464, - "y": 40 - } - }, - { - "id": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "type": "logic.gate.not", - "data": {}, - "position": { - "x": 272, - "y": 120 - } - } - ], - "wires": [ - { - "source": { - "block": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "port": "out" - }, - "target": { - "block": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "port": "18c2ebc7-5152-439c-9b3f-851c59bac834" - } - }, - { - "source": { - "block": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" - }, - "target": { - "block": "c39221a3-87dd-4524-9f65-879112b27f51", - "port": "in" - } - }, - { - "source": { - "block": "6ebac9b8-8eb9-4c4b-8b58-962ccc2919f4", - "port": "664caf9e-5f40-4df4-800a-b626af702e62" - }, - "target": { - "block": "7625149d-3511-4d95-8405-a100409a5d42", - "port": "in" - } - } - ] - }, - "deps": { - "logic.gate.not": { - "graph": { - "blocks": [ - { - "id": "18c2ebc7-5152-439c-9b3f-851c59bac834", - "type": "basic.input", - "data": { - "label": "" - }, - "position": { - "x": 64, - "y": 144 - } - }, - { - "id": "664caf9e-5f40-4df4-800a-b626af702e62", - "type": "basic.output", - "data": { - "label": "" - }, - "position": { - "x": 752, - "y": 144 - } - }, - { - "id": "5365ed8c-e5db-4445-938f-8d689830ea5c", - "type": "basic.code", - "data": { - "code": "// NOT logic gate\n\nassign c = ~ a;", - "ports": { - "in": [ - "a" - ], - "out": [ - "c" - ] - } - }, - "position": { - "x": 256, - "y": 48 - } - } - ], - "wires": [ - { - "source": { - "block": "18c2ebc7-5152-439c-9b3f-851c59bac834", - "port": "out" - }, - "target": { - "block": "5365ed8c-e5db-4445-938f-8d689830ea5c", - "port": "a" - } - }, - { - "source": { - "block": "5365ed8c-e5db-4445-938f-8d689830ea5c", - "port": "c" - }, - "target": { - "block": "664caf9e-5f40-4df4-800a-b626af702e62", - "port": "in" - } - } - ] - }, - "deps": {}, - "image": "resources/images/not.svg", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - } - } - } -} \ No newline at end of file diff --git a/demo/multi-constant-generic-block.ice b/demo/multi-constant-generic-block.ice deleted file mode 100644 index 152c349a2..000000000 --- a/demo/multi-constant-generic-block.ice +++ /dev/null @@ -1,199 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": -139, - "y": 20 - }, - "zoom": 1 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "eb6dddea-3a81-4e26-ab7d-ed107b3676c9", - "type": "constant-code-block", - "data": {}, - "position": { - "x": 248, - "y": 184 - } - }, - { - "id": "7217b44b-f3e6-4eb6-862b-1d55c0655ee7", - "type": "constant-code-block", - "data": {}, - "position": { - "x": 392, - "y": 328 - } - }, - { - "id": "3ea55b72-cda0-4f43-886b-e225b00229a4", - "type": "basic.constant", - "data": { - "label": "Value", - "value": "1'b1" - }, - "position": { - "x": 296, - "y": 32 - } - }, - { - "id": "06bd1d14-7302-4dd7-9e95-650d1070a203", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 536, - "y": 184 - } - }, - { - "id": "019e1dba-a150-483a-9c95-c2970ec781a9", - "type": "basic.output", - "data": { - "label": "led", - "pin": { - "name": "LED1", - "value": "96" - } - }, - "position": { - "x": 680, - "y": 328 - } - } - ], - "wires": [ - { - "source": { - "block": "7217b44b-f3e6-4eb6-862b-1d55c0655ee7", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "019e1dba-a150-483a-9c95-c2970ec781a9", - "port": "in" - } - }, - { - "source": { - "block": "3ea55b72-cda0-4f43-886b-e225b00229a4", - "port": "constant-out" - }, - "target": { - "block": "eb6dddea-3a81-4e26-ab7d-ed107b3676c9", - "port": "386bc685-d806-4487-bece-b442b8c8689c" - } - }, - { - "source": { - "block": "eb6dddea-3a81-4e26-ab7d-ed107b3676c9", - "port": "94e9a915-defe-4437-8abd-d3e57dafbb45" - }, - "target": { - "block": "06bd1d14-7302-4dd7-9e95-650d1070a203", - "port": "in" - } - }, - { - "source": { - "block": "3ea55b72-cda0-4f43-886b-e225b00229a4", - "port": "constant-out" - }, - "target": { - "block": "7217b44b-f3e6-4eb6-862b-1d55c0655ee7", - "port": "386bc685-d806-4487-bece-b442b8c8689c" - } - } - ] - }, - "deps": { - "constant-code-block": { - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - }, - "graph": { - "blocks": [ - { - "id": "386bc685-d806-4487-bece-b442b8c8689c", - "type": "basic.constant", - "data": { - "label": "C", - "value": "1'b0" - }, - "position": { - "x": 280, - "y": 48 - } - }, - { - "id": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "type": "basic.output", - "data": { - "label": "led" - }, - "position": { - "x": 624, - "y": 288 - } - }, - { - "id": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "type": "basic.code", - "data": { - "code": "assign o = v;", - "params": [ - "v" - ], - "ports": { - "in": [], - "out": [ - "o" - ] - } - }, - "position": { - "x": 136, - "y": 192 - } - } - ], - "wires": [ - { - "source": { - "block": "386bc685-d806-4487-bece-b442b8c8689c", - "port": "constant-out" - }, - "target": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "v" - } - }, - { - "source": { - "block": "b38fa7c5-3a2e-403b-b3d3-ac32917b5596", - "port": "o" - }, - "target": { - "block": "94e9a915-defe-4437-8abd-d3e57dafbb45", - "port": "in" - } - } - ] - }, - "deps": {} - } - } -} \ No newline at end of file diff --git a/demo/multi-input-output.ice b/demo/multi-input-output.ice deleted file mode 100644 index 335fd4e18..000000000 --- a/demo/multi-input-output.ice +++ /dev/null @@ -1,83 +0,0 @@ -{ - "image": "", - "state": { - "pan": { - "x": 0, - "y": 0 - }, - "zoom": 1 - }, - "board": "icezum", - "graph": { - "blocks": [ - { - "id": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "type": "basic.input", - "data": { - "label": "in", - "pin": { - "name": "SW1", - "value": "10" - } - }, - "position": { - "x": 168, - "y": 120 - } - }, - { - "id": "7625149d-3511-4d95-8405-a100409a5d42", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED1", - "value": "96" - } - }, - "position": { - "x": 408, - "y": 232 - } - }, - { - "id": "c39221a3-87dd-4524-9f65-879112b27f51", - "type": "basic.output", - "data": { - "label": "out", - "pin": { - "name": "LED0", - "value": "95" - } - }, - "position": { - "x": 480, - "y": 120 - } - } - ], - "wires": [ - { - "source": { - "block": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "port": "out" - }, - "target": { - "block": "7625149d-3511-4d95-8405-a100409a5d42", - "port": "in" - } - }, - { - "source": { - "block": "4f302bff-d4d1-4d6f-a7ec-b74698a3cd03", - "port": "out" - }, - "target": { - "block": "c39221a3-87dd-4524-9f65-879112b27f51", - "port": "in" - } - } - ] - }, - "deps": {} -} \ No newline at end of file diff --git a/samples/assign.ice b/samples/assign.ice new file mode 100644 index 000000000..8cf289611 --- /dev/null +++ b/samples/assign.ice @@ -0,0 +1,148 @@ +{ + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "909655b9-5ef0-4c45-9494-c0238d2e4732", + "type": "basic.constant", + "data": { + "name": "Value", + "value": "4'b1110", + "local": false + }, + "position": { + "x": 192, + "y": 56 + } + }, + { + "id": "7e351e09-634d-407c-ab7e-452519468292", + "type": "basic.constant", + "data": { + "name": "offset", + "value": "0", + "local": true + }, + "position": { + "x": 384, + "y": 56 + } + }, + { + "id": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "type": "basic.code", + "data": { + "code": "assign out = C + D;", + "params": [ + { + "name": "C" + }, + { + "name": "D" + } + ], + "ports": { + "in": [], + "out": [ + { + "name": "out", + "range": "[3:0]", + "size": 4 + } + ] + } + }, + "position": { + "x": 144, + "y": 200 + } + }, + { + "id": "ef743d41-5941-4831-becd-0d930c4eed54", + "type": "basic.output", + "data": { + "name": "out", + "range": "[3:0]", + "pins": [ + { + "index": "3", + "name": "LED3", + "value": "98" + }, + { + "index": "2", + "name": "LED2", + "value": "97" + }, + { + "index": "1", + "name": "LED1", + "value": "96" + }, + { + "index": "0", + "name": "LED0", + "value": "95" + } + ], + "virtual": false + }, + "position": { + "x": 672, + "y": 248 + } + } + ], + "wires": [ + { + "source": { + "block": "909655b9-5ef0-4c45-9494-c0238d2e4732", + "port": "constant-out" + }, + "target": { + "block": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "port": "C" + } + }, + { + "source": { + "block": "7e351e09-634d-407c-ab7e-452519468292", + "port": "constant-out" + }, + "target": { + "block": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "port": "D" + } + }, + { + "source": { + "block": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "port": "out" + }, + "target": { + "block": "ef743d41-5941-4831-becd-0d930c4eed54", + "port": "in" + }, + "size": 4 + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } +} \ No newline at end of file diff --git a/samples/block.ice b/samples/block.ice new file mode 100644 index 000000000..6609d744c --- /dev/null +++ b/samples/block.ice @@ -0,0 +1,230 @@ +{ + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "deddfc29-7bf1-4ac4-a24e-e91b4cc14335", + "type": "basic.constant", + "data": { + "name": "C", + "value": "4'b1111", + "local": false + }, + "position": { + "x": 296, + "y": 32 + } + }, + { + "id": "a9f85080-6523-428b-966c-359be16be956", + "type": "basic.constant", + "data": { + "name": "D", + "value": "4'b0000", + "local": true + }, + "position": { + "x": 488, + "y": 32 + } + }, + { + "id": "4aa2ce96-a449-42f1-b612-2c852dc50da8", + "type": "basic.input", + "data": { + "name": "p", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 680, + "y": 64 + } + }, + { + "id": "7f5654cf-4591-4a66-9147-d0cbdcb95f79", + "type": "basic.output", + "data": { + "name": "q", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 896, + "y": 64 + } + }, + { + "id": "fecaab8e-c7d4-4823-81fb-2b0d42f38026", + "type": "basic.code", + "data": { + "code": "reg [3:0] b_aux;\n\nalways @(a)\nbegin\n if (a == 1)\n b_aux = C;\n else\n b_aux = D;\nend\n\nassign b = b_aux;\n", + "params": [ + { + "name": "C" + }, + { + "name": "D" + } + ], + "ports": { + "in": [ + { + "name": "a", + "size": 1 + } + ], + "out": [ + { + "name": "b", + "range": "[3:0]", + "size": 4 + } + ] + } + }, + "position": { + "x": 248, + "y": 176 + } + }, + { + "id": "cbd336da-6d61-4c71-90e1-e11bbe6817fc", + "type": "basic.input", + "data": { + "name": "in", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 48, + "y": 272 + } + }, + { + "id": "15e91005-34e6-4ce9-80b4-8c33c6c1e5a0", + "type": "basic.output", + "data": { + "name": "out", + "range": "[3:0]", + "pins": [ + { + "index": "3", + "name": "", + "value": 0 + }, + { + "index": "2", + "name": "", + "value": 0 + }, + { + "index": "1", + "name": "", + "value": 0 + }, + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 760, + "y": 272 + } + } + ], + "wires": [ + { + "source": { + "block": "a9f85080-6523-428b-966c-359be16be956", + "port": "constant-out" + }, + "target": { + "block": "fecaab8e-c7d4-4823-81fb-2b0d42f38026", + "port": "D" + } + }, + { + "source": { + "block": "deddfc29-7bf1-4ac4-a24e-e91b4cc14335", + "port": "constant-out" + }, + "target": { + "block": "fecaab8e-c7d4-4823-81fb-2b0d42f38026", + "port": "C" + } + }, + { + "source": { + "block": "cbd336da-6d61-4c71-90e1-e11bbe6817fc", + "port": "out" + }, + "target": { + "block": "fecaab8e-c7d4-4823-81fb-2b0d42f38026", + "port": "a" + } + }, + { + "source": { + "block": "fecaab8e-c7d4-4823-81fb-2b0d42f38026", + "port": "b" + }, + "target": { + "block": "15e91005-34e6-4ce9-80b4-8c33c6c1e5a0", + "port": "in" + }, + "size": 4 + }, + { + "source": { + "block": "4aa2ce96-a449-42f1-b612-2c852dc50da8", + "port": "out" + }, + "target": { + "block": "7f5654cf-4591-4a66-9147-d0cbdcb95f79", + "port": "in" + } + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 24.988850906836912, + "y": 53.895818245976436 + }, + "zoom": 0.8154432847623143 + } + } +} \ No newline at end of file diff --git a/samples/complex.ice b/samples/complex.ice new file mode 100644 index 000000000..ab8b6a58c --- /dev/null +++ b/samples/complex.ice @@ -0,0 +1,623 @@ +{ + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "bfebb831-8b03-43e1-9b87-013f1b5a9cdf", + "type": "basic.constant", + "data": { + "name": "C", + "value": "4'b1010", + "local": false + }, + "position": { + "x": 128, + "y": 40 + } + }, + { + "id": "6c168fad-742d-42aa-a286-ec235bf61951", + "type": "assign", + "position": { + "x": 120, + "y": 184 + } + }, + { + "id": "731465bb-f103-4cf5-a273-79b43e628246", + "type": "mux", + "position": { + "x": 352, + "y": 200 + } + }, + { + "id": "fab70b68-1a4e-426c-8a29-fa02328401e7", + "type": "not", + "position": { + "x": 528, + "y": 200 + } + }, + { + "id": "0fbbb687-4a61-4b1d-a022-8884a20bef5c", + "type": "basic.output", + "data": { + "name": "led", + "pins": [ + { + "index": "0", + "name": "LED7", + "value": "104" + } + ], + "virtual": false + }, + "position": { + "x": 712, + "y": 200 + } + }, + { + "id": "21e9e7f9-9b8a-4fca-904d-e266f1496454", + "type": "basic.input", + "data": { + "name": "in", + "range": "[1:0]", + "pins": [ + { + "index": "1", + "name": "SW1", + "value": "10" + }, + { + "index": "0", + "name": "SW2", + "value": "11" + } + ], + "virtual": false + }, + "position": { + "x": 152, + "y": 280 + } + }, + { + "id": "6c809d38-547d-4c70-92eb-2d5c389429e7", + "type": "basic.output", + "data": { + "name": "debug", + "range": "[1:0]", + "pins": [ + { + "index": "1", + "name": "LED1", + "value": "96" + }, + { + "index": "0", + "name": "LED0", + "value": "95" + } + ], + "virtual": false + }, + "position": { + "x": 712, + "y": 280 + } + } + ], + "wires": [ + { + "source": { + "block": "bfebb831-8b03-43e1-9b87-013f1b5a9cdf", + "port": "constant-out" + }, + "target": { + "block": "6c168fad-742d-42aa-a286-ec235bf61951", + "port": "909655b9-5ef0-4c45-9494-c0238d2e4732" + } + }, + { + "source": { + "block": "6c168fad-742d-42aa-a286-ec235bf61951", + "port": "ef743d41-5941-4831-becd-0d930c4eed54" + }, + "target": { + "block": "731465bb-f103-4cf5-a273-79b43e628246", + "port": "95f8c313-6e18-4ee3-b9cf-7266dec53c93" + }, + "size": 4 + }, + { + "source": { + "block": "731465bb-f103-4cf5-a273-79b43e628246", + "port": "60d40fc8-3388-4066-8f0a-af17e179a9bd" + }, + "target": { + "block": "fab70b68-1a4e-426c-8a29-fa02328401e7", + "port": "a4058fa5-b66e-4e5e-b542-28d7c3e9d3cd" + } + }, + { + "source": { + "block": "21e9e7f9-9b8a-4fca-904d-e266f1496454", + "port": "out" + }, + "target": { + "block": "731465bb-f103-4cf5-a273-79b43e628246", + "port": "f6528039-852b-41f9-aa41-268994b3f631" + }, + "size": 2 + }, + { + "source": { + "block": "fab70b68-1a4e-426c-8a29-fa02328401e7", + "port": "07895985-9d14-4a6f-8f2d-b2a6ddf61852" + }, + "target": { + "block": "0fbbb687-4a61-4b1d-a022-8884a20bef5c", + "port": "in" + } + }, + { + "source": { + "block": "21e9e7f9-9b8a-4fca-904d-e266f1496454", + "port": "out" + }, + "target": { + "block": "6c809d38-547d-4c70-92eb-2d5c389429e7", + "port": "in" + }, + "size": 2 + } + ] + }, + "deps": { + "assign": { + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "graph": { + "blocks": [ + { + "id": "909655b9-5ef0-4c45-9494-c0238d2e4732", + "type": "basic.constant", + "data": { + "name": "Value", + "value": "4'b1110", + "local": false + }, + "position": { + "x": 192, + "y": 56 + } + }, + { + "id": "7e351e09-634d-407c-ab7e-452519468292", + "type": "basic.constant", + "data": { + "name": "offset", + "value": "0", + "local": true + }, + "position": { + "x": 384, + "y": 56 + } + }, + { + "id": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "type": "basic.code", + "data": { + "code": "assign out = C + D;", + "params": [ + { + "name": "C" + }, + { + "name": "D" + } + ], + "ports": { + "in": [], + "out": [ + { + "name": "out", + "range": "[3:0]", + "size": 4 + } + ] + } + }, + "position": { + "x": 144, + "y": 200 + } + }, + { + "id": "ef743d41-5941-4831-becd-0d930c4eed54", + "type": "basic.output", + "data": { + "name": "out", + "range": "[3:0]", + "pins": [ + { + "index": "3", + "name": "LED3", + "value": "98" + }, + { + "index": "2", + "name": "LED2", + "value": "97" + }, + { + "index": "1", + "name": "LED1", + "value": "96" + }, + { + "index": "0", + "name": "LED0", + "value": "95" + } + ], + "virtual": false + }, + "position": { + "x": 672, + "y": 248 + } + } + ], + "wires": [ + { + "source": { + "block": "909655b9-5ef0-4c45-9494-c0238d2e4732", + "port": "constant-out" + }, + "target": { + "block": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "port": "C" + } + }, + { + "source": { + "block": "7e351e09-634d-407c-ab7e-452519468292", + "port": "constant-out" + }, + "target": { + "block": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "port": "D" + } + }, + { + "source": { + "block": "b6bc7556-6362-45ca-80e5-6db7a3100c7d", + "port": "out" + }, + "target": { + "block": "ef743d41-5941-4831-becd-0d930c4eed54", + "port": "in" + }, + "size": 4 + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } + }, + "mux": { + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "graph": { + "blocks": [ + { + "id": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "type": "basic.code", + "data": { + "code": "// Multiplexer 4 to 1 \nassign out = data[sel];", + "params": [], + "ports": { + "in": [ + { + "name": "data", + "range": "[3:0]", + "size": 4 + }, + { + "name": "sel", + "range": "[1:0]", + "size": 2 + } + ], + "out": [ + { + "name": "out", + "size": 1 + } + ] + } + }, + "position": { + "x": 288, + "y": 112 + } + }, + { + "id": "95f8c313-6e18-4ee3-b9cf-7266dec53c93", + "type": "basic.input", + "data": { + "name": "d", + "range": "[3:0]", + "pins": [ + { + "index": "3", + "name": "", + "value": 0 + }, + { + "index": "2", + "name": "", + "value": 0 + }, + { + "index": "1", + "name": "", + "value": 0 + }, + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 48, + "y": 144 + } + }, + { + "id": "60d40fc8-3388-4066-8f0a-af17e179a9bd", + "type": "basic.output", + "data": { + "name": "out", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 760, + "y": 208 + } + }, + { + "id": "f6528039-852b-41f9-aa41-268994b3f631", + "type": "basic.input", + "data": { + "name": "s", + "range": "[1:0]", + "pins": [ + { + "index": "1", + "name": "", + "value": 0 + }, + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 48, + "y": 272 + } + } + ], + "wires": [ + { + "source": { + "block": "95f8c313-6e18-4ee3-b9cf-7266dec53c93", + "port": "out" + }, + "target": { + "block": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "port": "data" + }, + "size": 4 + }, + { + "source": { + "block": "f6528039-852b-41f9-aa41-268994b3f631", + "port": "out" + }, + "target": { + "block": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "port": "sel" + }, + "size": 2 + }, + { + "source": { + "block": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "port": "out" + }, + "target": { + "block": "60d40fc8-3388-4066-8f0a-af17e179a9bd", + "port": "in" + } + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } + }, + "not": { + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "graph": { + "blocks": [ + { + "id": "364b95cc-e8ff-4c65-b332-d6125c5968ee", + "type": "basic.code", + "data": { + "code": "// NOT logic gate\nassign b = ~a;", + "params": [], + "ports": { + "in": [ + { + "name": "a", + "size": 1 + } + ], + "out": [ + { + "name": "b", + "size": 1 + } + ] + } + }, + "position": { + "x": 248, + "y": 88 + } + }, + { + "id": "a4058fa5-b66e-4e5e-b542-28d7c3e9d3cd", + "type": "basic.input", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 72, + "y": 184 + } + }, + { + "id": "07895985-9d14-4a6f-8f2d-b2a6ddf61852", + "type": "basic.output", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 728, + "y": 184 + } + } + ], + "wires": [ + { + "source": { + "block": "a4058fa5-b66e-4e5e-b542-28d7c3e9d3cd", + "port": "out" + }, + "target": { + "block": "364b95cc-e8ff-4c65-b332-d6125c5968ee", + "port": "a" + } + }, + { + "source": { + "block": "364b95cc-e8ff-4c65-b332-d6125c5968ee", + "port": "b" + }, + "target": { + "block": "07895985-9d14-4a6f-8f2d-b2a6ddf61852", + "port": "in" + } + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } + } + }, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } +} \ No newline at end of file diff --git a/samples/in-out.ice b/samples/in-out.ice new file mode 100644 index 000000000..6989126d9 --- /dev/null +++ b/samples/in-out.ice @@ -0,0 +1,104 @@ +{ + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "b25e5929-162c-4631-8d04-156e0b382590", + "type": "basic.input", + "data": { + "name": "in", + "pins": [ + { + "index": "0", + "name": "SW1", + "value": "10" + } + ], + "virtual": false + }, + "position": { + "x": 224, + "y": 112 + } + }, + { + "id": "2a8315b1-437e-40b7-adfb-ff961a0aa8f6", + "type": "basic.output", + "data": { + "name": "out", + "pins": [ + { + "index": "0", + "name": "LED0", + "value": "95" + } + ], + "virtual": false + }, + "position": { + "x": 488, + "y": 112 + } + }, + { + "id": "f8ffb071-9a46-4b46-86d2-cd5b83bae395", + "type": "basic.output", + "data": { + "name": "out", + "pins": [ + { + "index": "0", + "name": "LED1", + "value": "96" + } + ], + "virtual": false + }, + "position": { + "x": 488, + "y": 248 + } + } + ], + "wires": [ + { + "source": { + "block": "b25e5929-162c-4631-8d04-156e0b382590", + "port": "out" + }, + "target": { + "block": "2a8315b1-437e-40b7-adfb-ff961a0aa8f6", + "port": "in" + } + }, + { + "source": { + "block": "b25e5929-162c-4631-8d04-156e0b382590", + "port": "out" + }, + "target": { + "block": "f8ffb071-9a46-4b46-86d2-cd5b83bae395", + "port": "in" + } + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } +} \ No newline at end of file diff --git a/samples/mux.ice b/samples/mux.ice new file mode 100644 index 000000000..f4d921c39 --- /dev/null +++ b/samples/mux.ice @@ -0,0 +1,170 @@ +{ + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "type": "basic.code", + "data": { + "code": "// Multiplexer 4 to 1 \nassign out = data[sel];", + "params": [], + "ports": { + "in": [ + { + "name": "data", + "range": "[3:0]", + "size": 4 + }, + { + "name": "sel", + "range": "[1:0]", + "size": 2 + } + ], + "out": [ + { + "name": "out", + "size": 1 + } + ] + } + }, + "position": { + "x": 288, + "y": 112 + } + }, + { + "id": "95f8c313-6e18-4ee3-b9cf-7266dec53c93", + "type": "basic.input", + "data": { + "name": "d", + "range": "[3:0]", + "pins": [ + { + "index": "3", + "name": "", + "value": 0 + }, + { + "index": "2", + "name": "", + "value": 0 + }, + { + "index": "1", + "name": "", + "value": 0 + }, + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 48, + "y": 144 + } + }, + { + "id": "60d40fc8-3388-4066-8f0a-af17e179a9bd", + "type": "basic.output", + "data": { + "name": "out", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 760, + "y": 208 + } + }, + { + "id": "f6528039-852b-41f9-aa41-268994b3f631", + "type": "basic.input", + "data": { + "name": "s", + "range": "[1:0]", + "pins": [ + { + "index": "1", + "name": "", + "value": 0 + }, + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 48, + "y": 272 + } + } + ], + "wires": [ + { + "source": { + "block": "95f8c313-6e18-4ee3-b9cf-7266dec53c93", + "port": "out" + }, + "target": { + "block": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "port": "data" + }, + "size": 4 + }, + { + "source": { + "block": "f6528039-852b-41f9-aa41-268994b3f631", + "port": "out" + }, + "target": { + "block": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "port": "sel" + }, + "size": 2 + }, + { + "source": { + "block": "5e1563d7-86de-4618-a9b0-2a08075af9ec", + "port": "out" + }, + "target": { + "block": "60d40fc8-3388-4066-8f0a-af17e179a9bd", + "port": "in" + } + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } +} \ No newline at end of file diff --git a/samples/not.ice b/samples/not.ice new file mode 100644 index 000000000..426794ebe --- /dev/null +++ b/samples/not.ice @@ -0,0 +1,111 @@ +{ + "version": "1.0", + "package": { + "name": "", + "version": "", + "description": "", + "author": "", + "image": "" + }, + "design": { + "board": "icezum", + "graph": { + "blocks": [ + { + "id": "364b95cc-e8ff-4c65-b332-d6125c5968ee", + "type": "basic.code", + "data": { + "code": "// NOT logic gate\nassign b = ~a;", + "params": [], + "ports": { + "in": [ + { + "name": "a", + "size": 1 + } + ], + "out": [ + { + "name": "b", + "size": 1 + } + ] + } + }, + "position": { + "x": 248, + "y": 88 + } + }, + { + "id": "a4058fa5-b66e-4e5e-b542-28d7c3e9d3cd", + "type": "basic.input", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 72, + "y": 184 + } + }, + { + "id": "07895985-9d14-4a6f-8f2d-b2a6ddf61852", + "type": "basic.output", + "data": { + "name": "", + "pins": [ + { + "index": "0", + "name": "", + "value": 0 + } + ], + "virtual": true + }, + "position": { + "x": 728, + "y": 184 + } + } + ], + "wires": [ + { + "source": { + "block": "a4058fa5-b66e-4e5e-b542-28d7c3e9d3cd", + "port": "out" + }, + "target": { + "block": "364b95cc-e8ff-4c65-b332-d6125c5968ee", + "port": "a" + } + }, + { + "source": { + "block": "364b95cc-e8ff-4c65-b332-d6125c5968ee", + "port": "b" + }, + "target": { + "block": "07895985-9d14-4a6f-8f2d-b2a6ddf61852", + "port": "in" + } + } + ] + }, + "deps": {}, + "state": { + "pan": { + "x": 0, + "y": 0 + }, + "zoom": 1 + } + } +} \ No newline at end of file diff --git a/tasks/toolchain_builder.js b/tasks/toolchain_builder.js index e8381aeaa..6b03cdcbd 100644 --- a/tasks/toolchain_builder.js +++ b/tasks/toolchain_builder.js @@ -25,7 +25,7 @@ function ToolchainBuilder(options) { // Assign options this.options = _.defaults(options, defaults); - if (this.options.platforms.length == 0) + if (this.options.platforms.length === 0) throw new Error('No platform to build!'); var venvRelease = 'virtualenv-15.0.1'; @@ -40,8 +40,8 @@ function ToolchainBuilder(options) { this.options.venvDir = path.join(this.options.toolchainDir, 'venv'); this.options.venvBinDir = path.join(this.options.venvDir, (process.platform === 'win32' ? 'Scripts' : 'bin')); - this.options.venvPip = path.join(this.options.venvBinDir, 'pip') - this.options.venvApio = path.join(this.options.venvBinDir, 'apio') + this.options.venvPip = path.join(this.options.venvBinDir, 'pip'); + this.options.venvApio = path.join(this.options.venvBinDir, 'apio'); } @@ -78,14 +78,14 @@ ToolchainBuilder.prototype.build = function (callback) { }); return hasCallback ? true : done.promise; -} +}; ToolchainBuilder.prototype.ensurePythonIsAvailable = function () { return new Promise(function(resolve, reject) { if (getPythonExecutable()) { resolve(); } else { reject('Python 2.7 is not available'); } }); -} +}; ToolchainBuilder.prototype.extractVirtualenv = function () { var self = this; @@ -94,9 +94,9 @@ ToolchainBuilder.prototype.extractVirtualenv = function () { targz().extract(self.options.venvTarPath, self.options.toolchainDir, function (error) { if (error) { reject(error); } else { resolve(); } - }) + }); }); -} +}; ToolchainBuilder.prototype.createVirtualenv = function () { var self = this; @@ -114,7 +114,7 @@ ToolchainBuilder.prototype.createVirtualenv = function () { } ); }); -} +}; ToolchainBuilder.prototype.downloadApio = function () { var self = this; @@ -131,7 +131,7 @@ ToolchainBuilder.prototype.downloadApio = function () { } ); }); -} +}; ToolchainBuilder.prototype.installApio = function () { var self = this; @@ -150,9 +150,9 @@ ToolchainBuilder.prototype.installApio = function () { } ); } - }) }); -} + }); +}; ToolchainBuilder.prototype.downloadApioPackages = function () { var self = this; @@ -163,7 +163,7 @@ ToolchainBuilder.prototype.downloadApioPackages = function () { return [ (process.platform === 'win32' ? 'set' : 'export'), 'APIO_HOME_DIR=' + dest + (process.platform === 'win32' ? '&' : ';'), self.options.venvApio, 'install', '--platform', platform ].concat(packages); - }; + } self.pFound = []; self.options.platforms.forEach(function(platform) { var p = getRealPlatform(platform); @@ -180,7 +180,7 @@ ToolchainBuilder.prototype.downloadApioPackages = function () { }); resolve(); }); -} +}; ToolchainBuilder.prototype.packageApio = function () { var self = this; @@ -194,7 +194,7 @@ ToolchainBuilder.prototype.packageApio = function () { else { resolve(); } }); }); -} +}; ToolchainBuilder.prototype.packageApioPackages = function () { var self = this; @@ -211,7 +211,7 @@ ToolchainBuilder.prototype.packageApioPackages = function () { path.join(self.options.apioPackagesDir, p), path.join(self.options.toolchainDir, 'default-apio-packages-' + p + '.tar.gz'), function (error) { - if (error) { reject(error) } + if (error) { reject(error); } callback(); } ); @@ -224,7 +224,7 @@ ToolchainBuilder.prototype.packageApioPackages = function () { resolve(); }); }); -} +}; ToolchainBuilder.prototype.createDefaultToolchains = function () { var self = this; @@ -252,7 +252,7 @@ ToolchainBuilder.prototype.createDefaultToolchains = function () { }); resolve(); }); -} +}; // Auxiliar functions