Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Math: added new block for relational operations of two inputs
Signed-off-by: Michal Lenc <michallenc@seznam.cz>
- Loading branch information
1 parent
e03acf4
commit 5c7c491
Showing
5 changed files
with
102 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"lib": "math", "name": "Relation Operator", "ip": 2, "op": 1, "stin": 0, "stout": 0, "icon": "REL", "params": "relBlk|operator: '=='"} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
from supsisim.RCPblk import RCPblk | ||
from scipy import size | ||
|
||
def relBlk(pin, pout, operator): | ||
""" | ||
Call: relBlk(pin, pout) | ||
Parameters | ||
---------- | ||
pin: connected input ports | ||
pout: connected output port | ||
operator: math operations to do | ||
Returns | ||
------- | ||
blk : RCPblk | ||
""" | ||
|
||
if(size(pout) != 1): | ||
raise ValueError("Block should have 1 output port; received %i." % size(pout)) | ||
|
||
blk = RCPblk('rel',pin,pout,[0,0],1,[],[], operator) | ||
return blk | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
This block performs relational operation on two inputs | ||
|
||
Supported operations: | ||
'==' inputs are equal | ||
'!=' inputs are not equal | ||
'>=' input 1 is greater than or equal to input 2 | ||
'<=' input 1 is less than or equal to input 2 | ||
'>' input 1 is greater than input 2 | ||
'<' input 1 is less than input 2 |