Method: Handshaker#read

Defined in:
lib/HDLRuby/hdr_samples/with_class.rb

#read(target, &blk) ⇒ Object

Generates a blocking read.

[View source]

104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# File 'lib/HDLRuby/hdr_samples/with_class.rb', line 104

def read(target,&blk)
    ibuffer = @ibuffer
    iread_valid  = @iread_valid
    iread_ready  = @iread_ready
    iwrite_valid = @iwrite_valid
    iwrite_ready = @iwrite_ready
    HDLRuby::High.cur_block.open do
        hif(iread_valid) do
            iwrite_valid <= 0
            iwrite_ready <= 0
            hif(iread_ready) do
                target <= ibuffer
                iwrite_valid <= 1
                blk.call if blk
            end
        end
        helse do
            iwrite_ready <= 1
        end
    end
end