Constructor
# new XnorGate(x, y, scopeopt, diropt, inputLengthopt, bitWidthopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
x |
number
|
x coordinate of element. | |
y |
number
|
y coordinate of element. | |
scope |
Scope
|
<optional> |
Cirucit on which element is drawn |
dir |
string
|
<optional> |
direction of element |
inputLength |
number
|
<optional> |
number of input nodes |
bitWidth |
number
|
<optional> |
bit width per node. |
Extends
Members
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:
- 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:
- absolute value of y
number
# changePropagationDelay(delay)
Method to change object delay
OVERRIDE if necessary
Parameters:
Name | Type | Description |
---|---|---|
delay |
number
|
new delay |
- Inherited From:
# 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:
# deleteNodes()
Helper Function to delete the element and all the node attached to it.
- Inherited From:
# draw()
Method that draws the outline of the module and calls draw function on module Nodes.
NOT OVERRIDABLE
- Inherited From:
# 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:
# flipBits(val) → {number}
Function to flip bits
Parameters:
Name | Type | Description |
---|---|---|
val |
number
|
the value of flipped bits |
- Inherited From:
- The number of flipped bits
number
# 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:
# isResolvable() → {boolean}
Method to check if object can be resolved
OVERRIDE if necessary
- Inherited From:
boolean
# isVerilogResolvable() → {boolean}
Helper Function to check if verilog resolvable
- Inherited From:
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:
# newBitWidth(bitWidth)
Method to change object Bitwidth
OVERRIDE if necessary
Parameters:
Name | Type | Description |
---|---|---|
bitWidth |
number
|
new bitwidth |
- Inherited From:
# newDirection(dir)
method to change direction
OVERRIDE WITH CAUTION
Parameters:
Name | Type | Description |
---|---|---|
dir |
string
|
new direction |
- Inherited From:
# newLabelDirection(dir)
Helper Function to change label direction of the element.
Parameters:
Name | Type | Description |
---|---|---|
dir |
string
|
new direction |
- Inherited From:
# saveObject() → {JSON}
To generate JSON-safe data that can be loaded
- Inherited From:
- the data to be saved
JSON
# 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:
# setLabel(label)
Helper Function to set label of an element.
Parameters:
Name | Type | Description |
---|---|---|
label |
string
|
the label for element |
- Inherited From:
# toggleLabelInLayoutMode()
Toggles the visibility of the labels of subcircuit elements. Called by event handlers in ux.js
- Inherited From:
# 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:
# 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: