Class: VhdlDoctest::TestFile
- Inherits:
-
Object
- Object
- VhdlDoctest::TestFile
- Defined in:
- lib/vhdl_doctest/test_file.rb
Instance Attribute Summary collapse
-
#cases ⇒ Object
readonly
Returns the value of attribute cases.
Instance Method Summary collapse
- #create(dir) ⇒ Object
-
#initialize(dut_entity, ports, cases) ⇒ TestFile
constructor
A new instance of TestFile.
- #path ⇒ Object
- #test_name ⇒ Object
Constructor Details
#initialize(dut_entity, ports, cases) ⇒ TestFile
Returns a new instance of TestFile.
5 6 7 8 9 |
# File 'lib/vhdl_doctest/test_file.rb', line 5 def initialize(dut_entity, ports, cases) @dut_entity = dut_entity @ports = ports @cases = cases end |
Instance Attribute Details
#cases ⇒ Object (readonly)
Returns the value of attribute cases.
3 4 5 |
# File 'lib/vhdl_doctest/test_file.rb', line 3 def cases @cases end |
Instance Method Details
#create(dir) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/vhdl_doctest/test_file.rb', line 23 def create(dir) @path = File.join(dir, test_name + ".vhd") File.open(@path, 'w') do |f| f << header + "\n\n" f << "architecture sim of #{test_name} is\n" f << dut_component f << signals f << UTILS f << "begin" f << dut_instantiation f << testcases f << "end sim;\n" end end |
#path ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/vhdl_doctest/test_file.rb', line 15 def path if @path @path else raise "This test file is not yet instantiated" end end |
#test_name ⇒ Object
11 12 13 |
# File 'lib/vhdl_doctest/test_file.rb', line 11 def test_name "testbench_" + @dut_entity end |