Method: HDLRuby::High::Std#decoder

Defined in:
lib/HDLRuby/std/decoder.rb

#decoder(*args, &ruby_block) ⇒ Object

Declare a new decoder. The arguments can be any of (but in this order):

  • +name+:: name.
  • +expr+:: the expression to decode.

If provided, +ruby_block+ the fsm is directly instantiated with it.



194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/HDLRuby/std/decoder.rb', line 194

def decoder(*args, &ruby_block)
    # Sets the name if any
    unless args[0].respond_to?(:to_expr) then
        name = args.shift.to_sym
    else
        name = :""
    end
    # Create the decoder.
    decoderI = DecoderT.new(name)

    # Is there a ruby block?
    if ruby_block then
        # Yes, generate the decoder.
        decoderI.build(*args,&ruby_block)
    else
        # No return the decoder structure for later generation.
        return decoderI
    end
end