Module: OrigenTesters::SmartestBasedTester::Pattern::Avc
- Included in:
- OrigenTesters::SmartestBasedTester::Pattern
- Defined in:
- lib/origen_testers/smartest_based_tester/decompiler/avc.rb
Instance Method Summary collapse
- #nodes_namespace ⇒ Object
- #parse_frontmatter(raw_frontmatter:, context:) ⇒ Object
- #parse_pinlist(raw_pinlist:, context:) ⇒ Object
- #parse_vector(raw_vector:, context:, meta:) ⇒ Object
Instance Method Details
#nodes_namespace ⇒ Object
7 8 9 |
# File 'lib/origen_testers/smartest_based_tester/decompiler/avc.rb', line 7 def nodes_namespace OrigenTesters::SmartestBasedTester::Decompiler::Avc end |
#parse_frontmatter(raw_frontmatter:, context:) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/origen_testers/smartest_based_tester/decompiler/avc.rb', line 11 def parse_frontmatter(raw_frontmatter:, context:) # So far, only seen patterns that have comments and/or whitespace in # the frontmatter. Not sure if anything else is allowed. # For this, every comment will be considered the 'header' header = [] raw_frontmatter.each_with_index do |l, i| if !(l =~ Regexp.new('^\s*#')).nil? header << l.chomp elsif l.strip.empty? # Whitespace. Do nothing. else Origen.app!.fail!("Unable to parse pattern frontmatter, at line: #{i}") end end OrigenTesters::Decompiler::Nodes::Frontmatter.new(context: context, pattern_header: header, comments: []) end |
#parse_pinlist(raw_pinlist:, context:) ⇒ Object
30 31 32 33 34 35 36 37 38 |
# File 'lib/origen_testers/smartest_based_tester/decompiler/avc.rb', line 30 def parse_pinlist(raw_pinlist:, context:) raw_pinlist = raw_pinlist.join('') # The pinlist can be parsed by grabbing everything between the 'format' token and the ';' # character then splitting by whitespace. Whitespace is then stripped to clean # up the names. # E.g.: FORMAT TCLK TDI TDO TMS; OrigenTesters::Decompiler::Nodes::Pinlist.new(context: context, pins: raw_pinlist[raw_pinlist.index('FORMAT')..raw_pinlist.index(';') - 1].split(/\s+/)[1..-1].map(&:strip)) end |
#parse_vector(raw_vector:, context:, meta:) ⇒ Object
40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 |
# File 'lib/origen_testers/smartest_based_tester/decompiler/avc.rb', line 40 def parse_vector(raw_vector:, context:, meta:) if raw_vector =~ Regexp.new('^\s*#') # Comment OrigenTesters::Decompiler::Nodes::CommentBlock.new(context: context, comments: raw_vector.split("\n")) elsif raw_vector =~ Regexp.new('^R\d+\s') # Vector elements = raw_vector.split(/\s+/, 2 + context.pinlist.size) elements[-1] = elements[-1].split(/\s/, 2) elements[-1][0] = elements[-1][0].gsub(';', '').chomp elements[-1][1] = elements[-1][1].gsub(';', '').chomp nodes_namespace::Vector.new(context: context, repeat: elements[0].gsub('R', '').to_i, timeset: elements[1], pin_states: (elements[2..-2] || []) << elements[-1][0], comment: elements[-1][1]) else # Anything that doesn't start with Rxyz where xyz is some integer # will be considered a sequencer instruction inst_plus_args = raw_vector.split(/\s+/) inst_plus_args.last.gsub!(';', '').strip! nodes_namespace::SequencerInstruction.new(context: context, instruction: inst_plus_args[0], arguments: inst_plus_args[1..-1]) end end |