Class: Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/HDLRuby/hruby_high.rb,
lib/HDLRuby/std/sequencer_sync.rb

Overview

Extends the Hash class for declaring signals of structure types.

Direct Known Subclasses

HDLRuby::Low::HashName

Instance Method Summary collapse

Instance Method Details

#constant(hsh) ⇒ Object

Declares high-level untyped constant signals by name and value given by hsh of the current type.

Retuns the last declared constant.



5537
5538
5539
5540
5541
5542
5543
5544
5545
# File 'lib/HDLRuby/hruby_high.rb', line 5537

def constant(hsh)
    res = nil
    hsh.each do |name,value|
        res = HDLRuby::High.top_user.
            add_inner(SignalC.new(name,
                      TypeStruct.new(:"",:little,self),:inner,value))
    end
    return res
end

#inner(*names) ⇒ Object

Declares high-level untyped inner signals named names of the current type.

Retuns the last declared inner.



5523
5524
5525
5526
5527
5528
5529
5530
5531
# File 'lib/HDLRuby/hruby_high.rb', line 5523

def inner(*names)
    res = nil
    names.each do |name|
        res = HDLRuby::High.top_user.
            add_inner(SignalI.new(name,
                            TypeStruct.new(:"",:little,self),:inner))
    end
    return res
end

#inout(*names) ⇒ Object

Declares high-level untyped inout signals named names of the current type.

Retuns the last declared inout.



5509
5510
5511
5512
5513
5514
5515
5516
5517
# File 'lib/HDLRuby/hruby_high.rb', line 5509

def inout(*names)
    res = nil
    names.each do |name|
        res = HDLRuby::High.top_user.
            add_inout(SignalI.new(name,
                            TypeStruct.new(:"",:little,self),:inout))
    end
    return res
end

#input(*names) ⇒ Object

Declares high-level input signals named names of the current type.

Retuns the last declared input.



5481
5482
5483
5484
5485
5486
5487
5488
5489
# File 'lib/HDLRuby/hruby_high.rb', line 5481

def input(*names)
    res = nil
    names.each do |name|
        res = HDLRuby::High.top_user.
            add_input(SignalI.new(name,
                            TypeStruct.new(:"",:little,self),:input))
    end
    return res
end

#output(*names) ⇒ Object

Declares high-level untyped output signals named names of the current type.

Retuns the last declared output.



5495
5496
5497
5498
5499
5500
5501
5502
5503
# File 'lib/HDLRuby/hruby_high.rb', line 5495

def output(*names)
    res = nil
    names.each do |name|
        res = HDLRuby::High.top_user.
            add_output(SignalI.new(name,
                            TypeStruct.new(:"",:little,self),:output))
    end
    return res
end

#shared(*names) ⇒ Object

Create new shared signals from args.



392
393
394
# File 'lib/HDLRuby/std/sequencer_sync.rb', line 392

def shared(*names)
    return self.to_type.shared(*names)
end

#to_type ⇒ Object

Converts to a new type.



5469
5470
5471
# File 'lib/HDLRuby/hruby_high.rb', line 5469

def to_type
    return TypeStruct.new(:"",:little,self)
end

#typedef(name) ⇒ Object

Declares a new type definition with name equivalent to current one.



5474
5475
5476
# File 'lib/HDLRuby/hruby_high.rb', line 5474

def typedef(name)
    return self.to_type.typedef(name)
end