https://mp.weixin.qq.com/s/4w_wwwCd6iBhh0QR2wK81Q
 
org.jchdl.model.gsl.core.datatype.net.Wire.java
 
generated by Intellij IDEA powered by yFiles.
 
一. 类结构
 
 
主要属性:
  • in
  • Input port.
     
  • out
  • Output port.
     
    主要方法:
  • 赋值方法
  • assign(Value)是在Wire的Input上赋值为Value。
     
  • 连线方法
  • 被连接:assign(Port)
  • assign(Port)表明Port连接到Wire的Input上。
  • 主动连接:connect(Port)
  • Wire的Output连接到Port上,成为Port的upstream。
     
  • 构造方法
  • 根据连线方式不同,Wire也提供了多个构造方法,以Wire的创建与连接。
  • Wire(): 默认构造方法,创建一条线,Input和Output为默认值,无连接;
  • Wire(Value):创建一条线,Input赋值为Value;
  • Wire(Input):创建一条线,从Input参数获得输入,即参数Input连接到Wire的Input上,作为upstream。
  • Wire(Output):创建一条线,输出到参数Output,即Wire的output连接到参数Output上。
  •  
  • getValue()
  • 获取线的值,(因为线的Input的值和Output的值总是相等,)实际上获取的是Output的值。
     
    静态方法:
  • pullup/pulldown
  • 方便处理线的输入恒为0/1的情况。
     
  • toGround()
  • 方便处理线的输出接地的情况。
     
     
    二. WireVec
     
    WireVec即Wire Vector,为辅助类,方便多根线或者一排线的处理,比如创建、赋值、连接等。
     
    主要属性:
  • wires[]
  • vector中包括的线。
     
    主要方法:
  • 构造方法
  • WireVec(int nBits): 创建一个包括nBits根线的Wire Vector;
  • WireVec(int nBits, Value): 创建一个包括nBits根线的Wire Vector,所有线赋值为Value;
  • WireVec(int, Input[]): 创建一个包括nBits根线的Wire Vector,所有线的Input被Input数组中的Input port连接;
  • WireVec(int, Output[]):创建一个包括nBits根线的Wire Vector,所有线的Output连接到数组织的Output上;
  • 连接方法
  • 被连接:assign(Port[])
  • 主动连接: connect(Port[])
  • 赋值方法
  • assign(Value): 所有线赋值为同一个Value;
  • assign(Value[]): 每根线分别赋值;
  •  
  • 获取其中线的方法
  • 获取所有线:wires();
  • 获取某根线:wire(int index): 获取第index根线(从0开始)。如果index = length, 则意为获取第一根线(index = 0);如果是负值,比如-1,意为获取最后一条线(index = length - 1)。
  • 获取部分线:wires(int from):获取从from开始的所有线;
  • 获取部分线:wires(int from, int to): [from, to) 获取从from(包含)到to(不包含)的线;
  •  
    静态方法
  • pullup/pulldown
  • 方便处理多根线的输入恒为0/1的情况。
  • toGround()
  • 方便处理多根线的输出接地的情况。
     
     

    相关文章:

    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    猜你喜欢
    • 2022-12-23
    • 2022-12-23
    • 2021-11-30
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    • 2022-12-23
    相关资源
    相似解决方案