Module: RubyHDL

Defined in:
lib/rubyHDL.rb

Overview

Module for accessing HDLRuby hardware from a ruby program excuted on an embedded processor: HDLRuby simulator version.

Class Method Summary collapse

Class Method Details

.inport(name, sig) ⇒ Object

Creates a new port 'name' assigned to signal 'sig' for reading.



10
11
12
13
14
15
16
# File 'lib/rubyHDL.rb', line 10

def self.inport(name,sig)
    # Create the accessing methods.
    # For reading.
    define_singleton_method(name.to_sym) do
        RCSim.rcsim_get_signal_fixnum(sig)
    end
end

.outport(name, sig) ⇒ Object

Creates a new wport 'name' assigned to signal 'sig' for writing.



19
20
21
22
23
24
# File 'lib/rubyHDL.rb', line 19

def self.outport(name,sig)
    # For writing.
    define_singleton_method(:"#{name}=") do |val|
        RCSim.rcsim_transmit_fixnum_to_signal_seq(sig,val)
    end
end

.program(name, code) ⇒ Object

Creates a new program 'name' assign to simulator code 'code'.



27
28
29
30
31
32
# File 'lib/rubyHDL.rb', line 27

def self.program(name,code)
    # Create the accessing method.
    define_singleton_method(name.to_sym) do
        code
    end
end