Class: OrigenTesters::VectorPipeline
- Inherits:
-
Object
- Object
- OrigenTesters::VectorPipeline
- Defined in:
- lib/origen_testers/vector_pipeline.rb
Instance Attribute Summary collapse
-
#cycle_count ⇒ Object
readonly
Returns the value of attribute cycle_count.
-
#group_size ⇒ Object
readonly
Returns the value of attribute group_size.
-
#pipeline ⇒ Object
readonly
Returns the value of attribute pipeline.
-
#vector_count ⇒ Object
readonly
Used to keep track of how many vectors since the last reset of the pipeline (i.e. since pattern start).
Instance Method Summary collapse
-
#<<(vector) ⇒ Object
Add a vector/comment to the pipeline.
-
#empty(options = {}, &block) ⇒ Object
Call at the end to force a flush out of any remaining vectors.
-
#flush(&block) ⇒ Object
If there are complete groups sitting at the top of the pipeline then this will yield them back line by line, stopping after the last complete group and leaving any remaining single vectors in the pipeline.
-
#initialize(group_size) ⇒ VectorPipeline
constructor
A new instance of VectorPipeline.
- #push_comment(comment) ⇒ Object
- #push_microcode(code) ⇒ Object
Constructor Details
#initialize(group_size) ⇒ VectorPipeline
Returns a new instance of VectorPipeline.
12 13 14 15 16 17 18 19 |
# File 'lib/origen_testers/vector_pipeline.rb', line 12 def initialize(group_size) @group_size = group_size @pipeline = [] # A new pipeline is instantiated per-pattern, so don't need to worry about # clearing this @vector_count = 0 @cycle_count = 0 end |
Instance Attribute Details
#cycle_count ⇒ Object (readonly)
Returns the value of attribute cycle_count.
10 11 12 |
# File 'lib/origen_testers/vector_pipeline.rb', line 10 def cycle_count @cycle_count end |
#group_size ⇒ Object (readonly)
Returns the value of attribute group_size.
5 6 7 |
# File 'lib/origen_testers/vector_pipeline.rb', line 5 def group_size @group_size end |
#pipeline ⇒ Object (readonly)
Returns the value of attribute pipeline.
5 6 7 |
# File 'lib/origen_testers/vector_pipeline.rb', line 5 def pipeline @pipeline end |
#vector_count ⇒ Object (readonly)
Used to keep track of how many vectors since the last reset of the pipeline (i.e. since pattern start). This is used to implement padding if there is a minimum vector requirement.
9 10 11 |
# File 'lib/origen_testers/vector_pipeline.rb', line 9 def vector_count @vector_count end |
Instance Method Details
#<<(vector) ⇒ Object
Add a vector/comment to the pipeline
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/origen_testers/vector_pipeline.rb', line 33 def <<(vector) if vector.is_a?(Vector) level_period(vector) do |vector| consume_comments(vector) if vector.repeat > 1 add_repeat_vector(vector) else pipeline << vector end end # Keep a persistent record of the last vector so that we know what it # was after the pipeline has been flushed @last_vector = pipeline.last elsif vector.is_a?(Symbol) case vector when :align duplicate_last_vector until aligned? when :align_last duplicate_last_vector until aligned_to_last? else fail "Uknown vector generator instruction: #{vector}" end else comments << vector end end |
#empty(options = {}, &block) ⇒ Object
Call at the end to force a flush out of any remaining vectors
79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/origen_testers/vector_pipeline.rb', line 79 def empty( = {}, &block) if !pipeline.empty? || !comments.empty? if [:min_vectors] comment_written = false while @vector_count < [:min_vectors] - pipeline.size unless comment_written yield "#{$tester.comment_char} PADDING VECTORS ADDED TO MEET MIN #{[:min_vectors]} FOR PATTERN" comment_written = true end yield_vector(@last_vector, &block) @cycle_count += @last_vector.repeat end end duplicate_last_vector until aligned? group_repeat_index = @group_size - 1 pipeline.each_index do |index| vector = pipeline[index] vector.comments.each do |comment| yield comment end yield_vector(vector, &block) if index % @group_size == 0 && index > 0 group_repeat_index += @group_size end @cycle_count += pipeline[group_repeat_index].repeat end comments.each do |comment| yield comment end @pipeline = [] @comments = [] end end |
#flush(&block) ⇒ Object
If there are complete groups sitting at the top of the pipeline then this will yield them back line by line, stopping after the last complete group and leaving any remaining single vectors in the pipeline
If there are no complete groups present then it will just return
65 66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/origen_testers/vector_pipeline.rb', line 65 def flush(&block) while lead_group_finalized? lead_group.each do |vector| vector.comments.each do |comment| yield comment end yield_vector(vector, &block) @cycle_count += pipeline[@group_size - 1].repeat end pipeline.shift(group_size) end end |
#push_comment(comment) ⇒ Object
21 22 23 |
# File 'lib/origen_testers/vector_pipeline.rb', line 21 def push_comment(comment) comments << comment end |
#push_microcode(code) ⇒ Object
25 26 27 28 29 30 |
# File 'lib/origen_testers/vector_pipeline.rb', line 25 def push_microcode(code) if $tester.v93k? && $tester.smt_version == 7 && code =~ /JSUB/ @vector_count += 1 end comments << code end |