pub fn new_constant(
        &mut self,
        val: u64,
        width: u64,
    ) -> errors::Result<(NodeIndex, ast::Id)> {
        let key = &(val, width);
        let port = ast::Id::new("out", None);
        if self.constants.contains_key(&key) {
            return Ok((self.constants[key], port));
        }
        // If the given constant doesn't already exist, create it and add it.
        let bitnum = ast::BitNum {
            width,
            num_type: ast::NumType::Decimal,
            val,
            span: None,
        };
        let (_, node) = Node::new_constant(&mut self.namegen, &bitnum);
        let idx = self.add_node(node);
        self.constants.insert(*key, idx);
        Ok((idx, port))
    }
/// Add a constant node into the structure graph. If the same (using
/// (val, width) tuple) constant has already been defined, return the
/// index of that node instead.
///
/// Returns the NodeIndex for the constant node and the port on which it
/// outputs the value.
Add a constant node into the structure graph. If the same (using
(val, width) tuple) constant has already been defined, return the
index of that node instead.

Returns the NodeIndex for the constant node and the port on which it
outputs the value.
Add a constant node into the structure graph . If the same ( using ( val width ) tuple ) constant has already been defined return the index of that node instead . Returns the NodeIndex for the constant node and the port on which it outputs the value .
pub fn new_constant(
        &mut self,
        val: u64,
        width: u64,
    ) -> errors::Result<(NodeIndex, ast::Id)> {
        let key = &(val, width);
        let port = ast::Id::new("out", None);
        if self.constants.contains_key(&key) {
            return Ok((self.constants[key], port));
        }
        // If the given constant doesn't already exist, create it and add it.
        let bitnum = ast::BitNum {
            width,
            num_type: ast::NumType::Decimal,
            val,
            span: None,
        };
        let (_, node) = Node::new_constant(&mut self.namegen, &bitnum);
        let idx = self.add_node(node);
        self.constants.insert(*key, idx);
        Ok((idx, port))
    }
pub fn new_constant ( & mut self , val : u64 , width : u64 , ) -> errors :: Result < ( NodeIndex , ast :: Id ) > { let key = & ( val , width ) ; let port = ast :: Id :: new ( " " , None ) ; if self . constants . contains_key ( & key ) { return Ok ( ( self . constants [ key ] , port ) ) ; } // If the given constant doesn't already exist, create it and add it. let bitnum = ast :: BitNum { width , num_type : ast :: NumType :: Decimal , val , span : None , } ; let ( _ , node ) = Node :: new_constant ( & mut self . namegen , & bitnum ) ; let idx = self . add_node ( node ) ; self . constants . insert ( * key , idx ) ; Ok ( ( idx , port ) ) }
Add a constant node into the structure graph.
Add a constant node into the structure graph .
&mut self
val
u64
width
u64