{
  "draw2d": [
    {
      "type": "shape_designer.figure.PolyRect",
      "id": "d5eed864-f9ab-239f-6b6b-6d500ff0b2b4",
      "x": 7960,
      "y": 7946,
      "width": 80,
      "height": 108,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "baseClass": "draw2d.SetFigure",
        "code": "/**\n * by 'Draw2D Shape Designer'\n *\n * Custom JS code to tweak the standard behaviour of the generated\n * shape. add your custome code and event handler here.\n *\n *\n */\ntestShape = testShape.extend({\n\n    init: function(attr, setter, getter){\n        this._super(attr, setter, getter);\n        this.attr({resizeable:false});\n        this.installEditPolicy(new draw2d.policy.figure.AntSelectionFeedbackPolicy());\n\n         // your special code here\n         this.last_t=false;\n         this.counter=0;\n    },\n\n    /**\n     *  Called by the simulator for every calculation\n     *  loop\n     *  @required\n     **/\n    calculate:function()\n    {\n        var t = this.getInputPort(0).getValue();\n\n        var rising = this.last_t===false && t===true; \n        if(rising===true){\n            var a = this.getOutputPort(\"out_a\");\n            var b = this.getOutputPort(\"out_b\");\n            var c = this.getOutputPort(\"out_c\");\n            var d = this.getOutputPort(\"out_d\");\n            a.setValue(!!(this.counter & 1));\n            b.setValue(!!(this.counter & 2));\n            c.setValue(!!(this.counter & 4));\n            d.setValue(!!(this.counter & 8));\n            this.counter= (this.counter+1)%10;\n        }\n        this.last_t = t;\n    },\n\n\n    /**\n     *  Called if the simulation mode is starting\n     *  @required\n     **/\n    onStart:function()\n    {\n    },\n\n    /**\n     *  Called if the simulation mode is stopping\n     *  @required\n     **/\n    onStop:function()\n    {\n    }\n});",
        "name": "Rectangle",
        "markdown": "# BCD Counter\n\n\nBCD = **B**inary **C**oded **D**ecimal = Counts from 0 to 9 and then repeats.\n\n\n\nA binary coded decimal (BCD) is a serial digital counter that counts\nten digits. And it resets for every new clock input. As it can go \nthrough 10 unique combinations of output, it is also called as \n `Decade counter` . A BCD counter can count 0000, 0001, 0010, \n1000, 1001, 1010, 1011, 1110, 1111, 0000, and 0001 and so on."
      },
      "cssClass": "shape_designer_figure_PolyRect",
      "ports": [],
      "bgColor": "#FFFFFF",
      "color": "#303030",
      "stroke": 1,
      "radius": 3,
      "dasharray": null,
      "vertices": [
        {
          "x": 7960,
          "y": 7946
        },
        {
          "x": 8040,
          "y": 7946
        },
        {
          "x": 8040,
          "y": 8054
        },
        {
          "x": 7960,
          "y": 8054
        }
      ],
      "blur": 0,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.SizeFilter"
        },
        {
          "name": "shape_designer.filter.StrokeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        },
        {
          "name": "shape_designer.filter.RadiusFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtLabel",
      "id": "09da8af5-a3ba-04d9-c6e7-f5619e30f121",
      "x": 7964.033331298828,
      "y": 7975,
      "width": 36.21666717529297,
      "height": 22,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Label"
      },
      "cssClass": "shape_designer_figure_ExtLabel",
      "ports": [],
      "bgColor": "none",
      "color": "#1B1B1B",
      "stroke": 0,
      "radius": 0,
      "dasharray": null,
      "text": "BCD -",
      "outlineStroke": 0,
      "outlineColor": "none",
      "fontSize": 14,
      "fontColor": "#080808",
      "fontFamily": null,
      "editor": "LabelInplaceEditor",
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FontSizeFilter"
        },
        {
          "name": "shape_designer.filter.FontColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtLabel",
      "id": "ffd6786f-b999-95dc-19fb-74355dc2e69d",
      "x": 7963.033331298828,
      "y": 7989.6,
      "width": 44.75,
      "height": 22,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Label"
      },
      "cssClass": "shape_designer_figure_ExtLabel",
      "ports": [],
      "bgColor": "none",
      "color": "#1B1B1B",
      "stroke": 0,
      "radius": 0,
      "dasharray": null,
      "text": "Counter",
      "outlineStroke": 0,
      "outlineColor": "none",
      "fontSize": 14,
      "fontColor": "#080808",
      "fontFamily": null,
      "editor": "LabelInplaceEditor",
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FontSizeFilter"
        },
        {
          "name": "shape_designer.filter.FontColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.PolyRect",
      "id": "ce91a191-8b7b-dc27-d6b6-15dd18bb01ca",
      "x": 7960,
      "y": 7957,
      "width": 18,
      "height": 17,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Rectangle"
      },
      "cssClass": "shape_designer_figure_PolyRect",
      "ports": [],
      "bgColor": "#FFFFFF",
      "color": "#303030",
      "stroke": 1,
      "radius": 0,
      "dasharray": null,
      "vertices": [
        {
          "x": 7960,
          "y": 7957
        },
        {
          "x": 7978,
          "y": 7965.742857142854
        },
        {
          "x": 7960,
          "y": 7974
        }
      ],
      "blur": 0,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.SizeFilter"
        },
        {
          "name": "shape_designer.filter.StrokeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtPort",
      "id": "3b9db0ed-1ba2-a98a-51cb-3a4f5af3550f",
      "x": 7954.033331298828,
      "y": 7960.5,
      "width": 10,
      "height": 10,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "input_t",
        "type": "Input",
        "direction": 3,
        "fanout": 1
      },
      "cssClass": "shape_designer_figure_ExtPort",
      "ports": [],
      "bgColor": "#1C9BAB",
      "color": "#1B1B1B",
      "stroke": 1,
      "dasharray": null,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FanoutFilter"
        },
        {
          "name": "shape_designer.filter.PortDirectionFilter"
        },
        {
          "name": "shape_designer.filter.PortTypeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtPort",
      "id": "4f83a764-63b8-7620-b479-a555e7c8f0d0",
      "x": 8034.680000000001,
      "y": 7956,
      "width": 10,
      "height": 10,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "out_a",
        "type": "Output",
        "direction": 1,
        "fanout": 20
      },
      "cssClass": "shape_designer_figure_ExtPort",
      "ports": [],
      "bgColor": "#1C9BAB",
      "color": "#1B1B1B",
      "stroke": 1,
      "dasharray": null,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FanoutFilter"
        },
        {
          "name": "shape_designer.filter.PortDirectionFilter"
        },
        {
          "name": "shape_designer.filter.PortTypeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtPort",
      "id": "543ba80d-b7f4-44a2-0588-734259ce1aa9",
      "x": 8035.680000000001,
      "y": 7981,
      "width": 10,
      "height": 10,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "out_b",
        "type": "Output",
        "direction": 1,
        "fanout": 20
      },
      "cssClass": "shape_designer_figure_ExtPort",
      "ports": [],
      "bgColor": "#1C9BAB",
      "color": "#1B1B1B",
      "stroke": 1,
      "dasharray": null,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FanoutFilter"
        },
        {
          "name": "shape_designer.filter.PortDirectionFilter"
        },
        {
          "name": "shape_designer.filter.PortTypeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtPort",
      "id": "9606e121-295b-5ec7-bcfa-b4ee534f4142",
      "x": 8035.680000000001,
      "y": 8006,
      "width": 10,
      "height": 10,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "out_c",
        "type": "Output",
        "direction": 1,
        "fanout": 20
      },
      "cssClass": "shape_designer_figure_ExtPort",
      "ports": [],
      "bgColor": "#1C9BAB",
      "color": "#1B1B1B",
      "stroke": 1,
      "dasharray": null,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FanoutFilter"
        },
        {
          "name": "shape_designer.filter.PortDirectionFilter"
        },
        {
          "name": "shape_designer.filter.PortTypeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtPort",
      "id": "5eedda0c-72c9-32eb-a653-fa2c22609619",
      "x": 8036.680000000001,
      "y": 8031,
      "width": 10,
      "height": 10,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "out_d",
        "type": "Output",
        "direction": 1,
        "fanout": 25
      },
      "cssClass": "shape_designer_figure_ExtPort",
      "ports": [],
      "bgColor": "#1C9BAB",
      "color": "#1B1B1B",
      "stroke": 1,
      "dasharray": null,
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FanoutFilter"
        },
        {
          "name": "shape_designer.filter.PortDirectionFilter"
        },
        {
          "name": "shape_designer.filter.PortTypeFilter"
        },
        {
          "name": "shape_designer.filter.FillColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtLabel",
      "id": "52e7f5ae-8cfa-054d-5fa5-d642c0839c2f",
      "x": 8019.017706298828,
      "y": 7951,
      "width": 29.760000228881836,
      "height": 22,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Label"
      },
      "cssClass": "shape_designer_figure_ExtLabel",
      "ports": [],
      "bgColor": "none",
      "color": "#1B1B1B",
      "stroke": 0,
      "radius": 0,
      "dasharray": null,
      "text": "A",
      "outlineStroke": 0,
      "outlineColor": "none",
      "fontSize": 10,
      "fontColor": "#080808",
      "fontFamily": null,
      "editor": "LabelInplaceEditor",
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FontSizeFilter"
        },
        {
          "name": "shape_designer.filter.FontColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtLabel",
      "id": "9ba647d0-d381-6054-3a88-a2d1729afd03",
      "x": 8019.017706298828,
      "y": 7976.5,
      "width": 29.760000228881836,
      "height": 22,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Label"
      },
      "cssClass": "shape_designer_figure_ExtLabel",
      "ports": [],
      "bgColor": "none",
      "color": "#1B1B1B",
      "stroke": 0,
      "radius": 0,
      "dasharray": null,
      "text": "B",
      "outlineStroke": 0,
      "outlineColor": "none",
      "fontSize": 10,
      "fontColor": "#080808",
      "fontFamily": null,
      "editor": "LabelInplaceEditor",
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FontSizeFilter"
        },
        {
          "name": "shape_designer.filter.FontColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtLabel",
      "id": "4383cbe5-c972-dc30-b5fc-f2ba855839a5",
      "x": 8019.017706298828,
      "y": 8000.5,
      "width": 29.760000228881836,
      "height": 22,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Label"
      },
      "cssClass": "shape_designer_figure_ExtLabel",
      "ports": [],
      "bgColor": "none",
      "color": "#1B1B1B",
      "stroke": 0,
      "radius": 0,
      "dasharray": null,
      "text": "C",
      "outlineStroke": 0,
      "outlineColor": "none",
      "fontSize": 10,
      "fontColor": "#080808",
      "fontFamily": null,
      "editor": "LabelInplaceEditor",
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FontSizeFilter"
        },
        {
          "name": "shape_designer.filter.FontColorFilter"
        }
      ]
    },
    {
      "type": "shape_designer.figure.ExtLabel",
      "id": "b4d73868-0dfd-060d-7dfb-a9216147df63",
      "x": 8019.017706298828,
      "y": 8025.5,
      "width": 29.760000228881836,
      "height": 22,
      "alpha": 1,
      "angle": 0,
      "userData": {
        "name": "Label"
      },
      "cssClass": "shape_designer_figure_ExtLabel",
      "ports": [],
      "bgColor": "none",
      "color": "#1B1B1B",
      "stroke": 0,
      "radius": 0,
      "dasharray": null,
      "text": "D",
      "outlineStroke": 0,
      "outlineColor": "none",
      "fontSize": 10,
      "fontColor": "#080808",
      "fontFamily": null,
      "editor": "LabelInplaceEditor",
      "filters": [
        {
          "name": "shape_designer.filter.PositionFilter"
        },
        {
          "name": "shape_designer.filter.FontSizeFilter"
        },
        {
          "name": "shape_designer.filter.FontColorFilter"
        }
      ]
    }
  ],
  "image": "data:image/png;base64, "
}