Class

SubCircuit

SubCircuit(x, y, scopeopt, id, savedData)

Constructor

# new SubCircuit(x, y, scopeopt, id, savedData)

Parameters:
Name Type Attributes Description
x number x coord of subcircuit
y number y coord of subcircuit
scope Scope <optional>
the circuit in which subcircuit has been added
id string the id of the subcircuit scope
savedData JSON the saved data

View Source subcircuit.js, line 93

Extends

Methods

# absX(x) → {number}

Function to get absolute value of x coordinate of the element
Parameters:
Name Type Description
x number value of x coordinate of the element
Inherited From:

View Source circuitElement.js, line 96

- absolute value of x
number

# absY(y) → {number}

Function to get absolute value of y coordinate of the element
Parameters:
Name Type Description
y number value of y coordinate of the element
Inherited From:

View Source circuitElement.js, line 105

- absolute value of y
number

# addInputs()

adds all local scope inputs to the global scope simulation queue

View Source subcircuit.js, line 526

# baseSetup()

adds the element to scopeList
Inherited From:

View Source circuitElement.js, line 112

# buildCircuit()

loads the subcircuit and draws all the nodes

View Source subcircuit.js, line 254

# changePropagationDelay(delay)

Method to change object delay OVERRIDE if necessary
Parameters:
Name Type Description
delay number new delay
Inherited From:

View Source circuitElement.js, line 719

# checkHover() → {boolean}

check hover over the element
Overrides:

View Source circuitElement.js, line 186

boolean

# cleanDelete()

method to delete object OVERRIDE WITH CAUTION
Inherited From:

View Source circuitElement.js, line 646

# click()

Procedure after a element is clicked inside a subcircuit

View Source subcircuit.js, line 486

# copyFrom(obj)

Function to copy the circuit element obj to a new circuit element
Parameters:
Name Type Description
obj CircuitElement element to be copied from
Inherited From:

View Source circuitElement.js, line 120

# customDraw()

Draws the subcircuit (and contained elements) on the screen when the subcircuit is included in another circuit

View Source subcircuit.js, line 621

# customSave() → {JSON}

Always overriden
Inherited From:

View Source circuitElement.js, line 174

- the data to be saved
JSON

# dblclick()

Procedure if any element is double clicked inside a subcircuit

View Source subcircuit.js, line 547

# deleteNodes()

Helper Function to delete the element and all the node attached to it.
Inherited From:

View Source circuitElement.js, line 654

# determine_label()

determines where to show label

View Source subcircuit.js, line 594

# drag()

Helper Function to drag element to a new position
Inherited From:

View Source circuitElement.js, line 252

# draw()

Method that draws the outline of the module and calls draw function on module Nodes. NOT OVERRIDABLE
Inherited From:

View Source circuitElement.js, line 501

# drawLayoutMode(xOffset, yOffset)

Draws element in layout mode (inside the subcircuit)
Parameters:
Name Type Default Description
xOffset number 0 x position of the subcircuit
yOffset number 0 y position of the subcircuit Called by subcirucit.js/customDraw() - for drawing as a part of another circuit and layoutMode.js/renderLayout() - for drawing in layoutMode
Inherited From:

View Source circuitElement.js, line 584

# fixDirection()

Helper Function to correct the direction of element
Inherited From:

View Source circuitElement.js, line 427

# flipBits(val) → {number}

Function to flip bits
Parameters:
Name Type Description
val number the value of flipped bits
Inherited From:

View Source circuitElement.js, line 87

- The number of flipped bits
number

# generateVerilog() → {JSON}

Helper Function to generate verilog
Inherited From:

View Source circuitElement.js, line 840

JSON

# isHover()

The isHover method is used to check if the mouse is hovering over the object. Return Value: true if mouse is hovering over object else false NOT OVERRIDABLE
Inherited From:

View Source circuitElement.js, line 437

# isResolvable()

By design, subcircuit element's input and output nodes are wirelessly connected to the localscope (clone of the scope of the subcircuit's circuit). So it is almost like the actual circuit is copied in the location of the subcircuit element. Therefore no resolve needed.
Overrides:

View Source subcircuit.js, line 576

# isVerilogResolvable() → {boolean}

Helper Function to check if verilog resolvable
Inherited From:

View Source circuitElement.js, line 767

boolean

# layoutUpdate()

Used to update the state of the elements inside the subcircuit in layout mode Return Value: true if the state has changed, false otherwise
Inherited From:

View Source circuitElement.js, line 359

# makeConnections()

actually make all connection but are invisible so it seems like the simulation is happening in other Scope but it actually is not.

View Source subcircuit.js, line 220

# newBitWidth(bitWidth)

Method to change object Bitwidth OVERRIDE if necessary
Parameters:
Name Type Description
bitWidth number new bitwidth
Inherited From:

View Source circuitElement.js, line 706

# newDirection(dir)

method to change direction OVERRIDE WITH CAUTION
Parameters:
Name Type Description
dir string new direction
Inherited From:

View Source circuitElement.js, line 663

# newLabelDirection(dir)

Helper Function to change label direction of the element.
Parameters:
Name Type Description
dir string new direction
Inherited From:

View Source circuitElement.js, line 684

# processVerilog()

Helper Function to process verilog
Inherited From:

View Source circuitElement.js, line 739

# reBuildCircuit()

If the circuit referenced by localscope is changed, then the localscope needs to be updated. This function does that.

View Source subcircuit.js, line 304

# releaseClick()

Sets the elements' wasClicked property in the subcircuit to false

View Source subcircuit.js, line 516

# removeConnections()

Function to remove wireless connections

View Source subcircuit.js, line 237

# removePropagation()

If element not resolvable (always in subcircuits), removePropagation is called on it.
Overrides:

View Source subcircuit.js, line 584

# resolve()

Dummy resolve function OVERRIDE if necessary
Inherited From:

View Source circuitElement.js, line 732

# saveObject()

Returns a javascript object of subcircuit data. Does not include data of subcircuit elements apart from Input and Output (that is a part of element.subcircuitMetadata)
Overrides:

View Source subcircuit.js, line 556

# setDimensions(w, h)

This sets the width and height of the element if its rectangular and the reference point is at the center of the object. width and height define the X and Y distance from the center. Effectively HALF the actual width and height. NOT OVERRIDABLE
Parameters:
Name Type Description
w number width
h number height
Inherited From:

View Source circuitElement.js, line 214

# setHeight(h)

Parameters:
Name Type Description
h number height
Inherited From:

View Source circuitElement.js, line 230

# setLabel(label)

Helper Function to set label of an element.
Parameters:
Name Type Description
label string the label for element
Inherited From:

View Source circuitElement.js, line 493

# setOutputsUpstream()

Sets isValueUpstream for all output nodes of the element.
Inherited From:

View Source circuitElement.js, line 807

# setWidth(w)

Parameters:
Name Type Description
w number width
Inherited From:

View Source circuitElement.js, line 223

# startDragging()

Helper Function to drag element to a new position
Inherited From:

View Source circuitElement.js, line 237

# toggleLabelInLayoutMode()

Toggles the visibility of the labels of subcircuit elements. Called by event handlers in ux.js
Inherited From:

View Source circuitElement.js, line 866

# update()

The update method is used to change the parameters of the object on mouse click and hover. Return Value: true if state has changed else false NOT OVERRIDABLE
Inherited From:

View Source circuitElement.js, line 268

# updateScope(scope)

Function to update the scope when a new element is added.
Parameters:
Name Type Description
scope Scope the circuit in which we add element
Inherited From:

View Source circuitElement.js, line 142

# verilogName() → {string}

Helper Function to name the verilog.
Overrides:

View Source circuitElement.js, line 819

string