Class: ISE::Project
Constant Summary collapse
- GoalProperty =
'Last Applied Goal'
- ShortNameProperty =
'PROP_DesignName'
- OutputNameProperty =
'Output File Name'
- TopLevelFileProperty =
'Implementation Top File'
- WorkingDirectoryProperty =
'Working Directory'
Instance Attribute Summary collapse
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
Instance Method Summary collapse
-
#bit_file ⇒ Object
Returns the best-guess path to the most recently generated bit file, or nil if we weren’t able to find one.
-
#get_property(name) ⇒ Object
Returns the value of a project property.
-
#minimize_runtime! ⇒ Object
Attempts to minimize synthesis runtime of a _single run_.
-
#set_property(name, value, mark_non_default = true) ⇒ Object
Sets the value of an ISE project property.
-
#top_level_file(absolute_path = true) ⇒ Object
Returns a path to the top-level file in the given project.
-
#working_directory ⇒ Object
Returns the project’s working directory.
Methods inherited from XMLFile
Constructor Details
This class inherits a constructor from ISE::XMLFile
Instance Attribute Details
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
17 18 19 |
# File 'lib/ise/project.rb', line 17 def filename @filename end |
Instance Method Details
#bit_file ⇒ Object
Returns the best-guess path to the most recently generated bit file, or nil if we weren’t able to find one.
94 95 96 97 98 99 100 101 102 103 104 105 106 |
# File 'lib/ise/project.rb', line 94 def bit_file #Determine ISE's working directory. working_directory = get_property(WorkingDirectoryProperty) #Find an absolute path at which the most recently generated bit file should reside. name = get_property(OutputNameProperty) name = File.("#{working_directory}/#{name}.bit", @base_path) #If it exists, return it. File::exists?(name) ? name : nil end |
#get_property(name) ⇒ Object
Returns the value of a project property.
22 23 24 25 26 27 28 |
# File 'lib/ise/project.rb', line 22 def get_property(name) #Retreive the value of the node with the given property. node = get_property_node(name) node.attribute("value").value end |
#minimize_runtime! ⇒ Object
Attempts to minimize synthesis runtime of a _single run_.
This will place all intermediary files in RAM- which means that synthesis results won’t be preserved between reboots!
50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/ise/project.rb', line 50 def minimize_runtime! #Compute the path in which temporary synthesis files should be created. shortname = CGI::escape(get_property(ShortNameProperty)) temp_path = Dir::mktmpdir([shortname, '']) #Synthesize from RAM. set_property(WorkingDirectoryProperty, temp_path) #Ask the project to focus on runtime over performance. set_property(GoalProperty, 'Minimum Runtime') end |
#set_property(name, value, mark_non_default = true) ⇒ Object
Sets the value of an ISE project property.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/ise/project.rb', line 33 def set_property(name, value, mark_non_default=true) #Set the node's property, as specified. node = get_property_node(name) node.attribute("value").value = value #If the mark non-default option is set, mark the state is not a default value. node.attribute("valueState").value = 'non-default' if mark_non_default end |
#top_level_file(absolute_path = true) ⇒ Object
Returns a path to the top-level file in the given project.
absoulute_path: If set when the project file’s path is known, an absolute path will be returned.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/ise/project.rb', line 69 def top_level_file(absolute_path=true) path = get_property(TopLevelFileProperty) #If the absolute_path flag is set, and we know how, expand the file path. if absolute_path path = File.(path, @base_path) end #Return the relevant path. path end |
#working_directory ⇒ Object
Returns the project’s working directory.
86 87 88 |
# File 'lib/ise/project.rb', line 86 def working_directory File.(get_property(WorkingDirectoryProperty), @base_path) end |