Class: AxiTdl::AxisVerify::SimpleStreams

Inherits:
Object
  • Object
show all
Defined in:
lib/tdl/exlib/axis_verify.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(length: [10,200], gap_len: [0,10], data: [ (0...100) ] * 10, vld_perc: [50, 100], dsize: 8) ⇒ SimpleStreams

Returns a new instance of SimpleStreams.



83
84
85
86
87
88
89
90
91
92
93
94
# File 'lib/tdl/exlib/axis_verify.rb', line 83

def initialize(length: [10,200], gap_len: [0,10], data: [ (0...100) ] * 10 , vld_perc: [50, 100], dsize: 8)
    max_len = [length.size, gap_len.size, data.size , vld_perc.size ].max
    @lengths = length.to_a * (max_len / length.size + 1 )
    @gap_lens = gap_len.to_a * (max_len / gap_len.size + 1 )
    @datas = data.to_a * (max_len / data.size + 1 )
    @vld_percs = vld_perc.to_a * (max_len / vld_perc.size + 1 )
    
    @dsize = dsize 
    @max_len = max_len
    @streams = []
    gen_itr
end

Instance Attribute Details

#streamsObject

Returns the value of attribute streams.



82
83
84
# File 'lib/tdl/exlib/axis_verify.rb', line 82

def streams
  @streams
end

Instance Method Details

#coeObject



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/tdl/exlib/axis_verify.rb', line 103

def coe 
    collect = []
    @max_len.times do |index|
         ## add grap 
        if @gap_lens[index] != 0
            collect += ["0"]*@gap_lens[index]
        end 
        itr = @streams[index]
        collect += itr.stream_context
    end

    mmp = [] 
    collect.each_index do |index| 
        mmp << "@%04x #{collect[index]}\n"%index
    end

    mmp.join("")

end

#gen_itrObject



96
97
98
99
100
101
# File 'lib/tdl/exlib/axis_verify.rb', line 96

def gen_itr 
    @max_len.times do |index|
       itr = Iteration.new(length: @lengths[index], data: @datas[index], vld_perc: @vld_percs[index],user:[0], keep:[1] , rand_seed: index ,dsize: @dsize, usize: 1)
       streams << itr
   end
end