Class: Udb::XlenTerm
- Inherits:
-
Object
- Object
- Udb::XlenTerm
- Extended by:
- T::Sig
- Includes:
- Comparable
- Defined in:
- lib/udb/logic.rb
Instance Attribute Summary collapse
-
#xlen ⇒ Object
readonly
Returns the value of attribute xlen.
Instance Method Summary collapse
- #<=>(other) ⇒ Integer?
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Integer
hash and eql? must be implemented to use XlenTerm as a Hash key.
- #initialize(xlen) constructor
- #to_asciidoc ⇒ String
- #to_condition(cfg_arch) ⇒ Condition
- #to_h ⇒ Hash{String => Integer}
- #to_idl(cfg_arch) ⇒ String
- #to_s ⇒ String
- #to_s_pretty ⇒ String
- #to_z3(solver) ⇒ Z3::BoolExpr
Constructor Details
#initialize(xlen)
47 48 49 50 51 52 53 54 |
# File 'lib/udb/logic.rb', line 47 def initialize(xlen) @xlen = xlen @to_s = "xlen=#{@xlen}".freeze @to_h = { "xlen" => @xlen }.freeze @hash = to_s.hash end |
Instance Attribute Details
#xlen ⇒ Object (readonly)
Returns the value of attribute xlen.
44 45 46 |
# File 'lib/udb/logic.rb', line 44 def xlen @xlen end |
Instance Method Details
#<=>(other) ⇒ Integer?
93 94 95 96 97 |
# File 'lib/udb/logic.rb', line 93 def <=>(other) return nil unless other.is_a?(XlenTerm) @xlen <=> other.xlen end |
#eql?(other) ⇒ Boolean
109 110 111 |
# File 'lib/udb/logic.rb', line 109 def eql?(other) (self <=> other) == 0 end |
#hash ⇒ Integer
hash and eql? must be implemented to use XlenTerm as a Hash key
101 |
# File 'lib/udb/logic.rb', line 101 def hash = @hash |
#to_asciidoc ⇒ String
75 |
# File 'lib/udb/logic.rb', line 75 def to_asciidoc = "xlen+++()+++ == #{@xlen}" |
#to_condition(cfg_arch) ⇒ Condition
57 58 59 |
# File 'lib/udb/logic.rb', line 57 def to_condition(cfg_arch) Condition.new({ "xlen" => @xlen }, cfg_arch) end |
#to_h ⇒ Hash{String => Integer}
78 79 80 |
# File 'lib/udb/logic.rb', line 78 def to_h @to_h end |
#to_idl(cfg_arch) ⇒ String
83 84 85 |
# File 'lib/udb/logic.rb', line 83 def to_idl(cfg_arch) "(xlen() == #{@xlen})" end |
#to_s ⇒ String
62 63 64 |
# File 'lib/udb/logic.rb', line 62 def to_s @to_s end |
#to_s_pretty ⇒ String
72 |
# File 'lib/udb/logic.rb', line 72 def to_s_pretty = to_s |
#to_z3(solver) ⇒ Z3::BoolExpr
67 68 69 |
# File 'lib/udb/logic.rb', line 67 def to_z3(solver) solver.xlen == @xlen end |