Struct source_generator::vhdl::library_use::LibraryUse
source · pub struct LibraryUse { /* private fields */ }Implementations§
source§impl LibraryUse
impl LibraryUse
sourcepub fn new(library: &str, package: &str) -> LibraryUse
pub fn new(library: &str, package: &str) -> LibraryUse
Examples found in repository?
examples/generate_vhdl_adder.rs (line 13)
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
fn main() -> Result< (), std::io::Error > {
let mut entity = Entity::new( "adder" );
entity.add_library_use( LibraryUse::new( "ieee", "numeric_std" ) );
entity.add_generic( Generic::new_with_default( "SIZE", "positive", "32" ) );
entity.add_port( Port::new( "a", Direction::IN, "unsigned( SIZE - 1 downto 0 )" ) );
entity.add_port( Port::new( "b", Direction::IN, "unsigned( SIZE - 1 downto 0 )" ) );
entity.add_port( Port::new( "c", Direction::OUT, "unsigned( SIZE - 1 downto 0 )" ) );
let mut architecture = Architecture::new( "rtl", "adder" );
architecture.add_signal_assignment( SignalAssignment::new_with_label( "add", "c", "a + b" ));
let mut vhdl_file = VhdlFile::new( "examples/adder.vhd" );
vhdl_file.add_entity( entity );
vhdl_file.add_architecture( architecture );
vhdl_file.write()?;
Ok(())
}pub fn new_with_element(library: &str, package: &str, element: &str) -> LibraryUse
pub fn get_library_name(&self) -> &String
Trait Implementations§
source§impl Element for LibraryUse
impl Element for LibraryUse
fn to_source_code(&self, indent: usize) -> String
source§impl Hash for LibraryUse
impl Hash for LibraryUse
source§impl PartialEq<LibraryUse> for LibraryUse
impl PartialEq<LibraryUse> for LibraryUse
source§fn eq(&self, other: &LibraryUse) -> bool
fn eq(&self, other: &LibraryUse) -> bool
This method tests for
self and other values to be equal, and is used
by ==.