Class: Rhdl::UnOp
- Inherits:
-
Expression
- Object
- Expression
- Rhdl::UnOp
- Defined in:
- lib/rhdl/un_op.rb
Instance Method Summary collapse
- #fanout(check_context, statement) ⇒ Object
- #generate ⇒ Object
- #get_output_type(check_context) ⇒ Object
-
#initialize(lhs, op) ⇒ UnOp
constructor
A new instance of UnOp.
- #varnames ⇒ Object
Methods inherited from Expression
Constructor Details
#initialize(lhs, op) ⇒ UnOp
Returns a new instance of UnOp.
3 4 5 6 |
# File 'lib/rhdl/un_op.rb', line 3 def initialize(lhs, op) @lhs = lhs @op = op end |
Instance Method Details
#fanout(check_context, statement) ⇒ Object
16 17 18 |
# File 'lib/rhdl/un_op.rb', line 16 def fanout(check_context, statement) @lhs.fanout(check_context, statement) end |
#generate ⇒ Object
12 13 14 |
# File 'lib/rhdl/un_op.rb', line 12 def generate "!(#{@lhs.generate})" end |
#get_output_type(check_context) ⇒ Object
20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/rhdl/un_op.rb', line 20 def get_output_type(check_context) ltype = @lhs.get_output_type(check_context) if @op == "!" if ltype.to_s != "uint_1" raise "& does not support types #{ltype}" end return ltype else raise "unknown operation '#{op}'" end end |
#varnames ⇒ Object
8 9 10 |
# File 'lib/rhdl/un_op.rb', line 8 def varnames @lhs.varnames end |