나는 official web page에 주어진 GCD 예제로 Chisel3을 배우려고합니다. 이 예제에서는 - %라는 연산자를 사용합니다. 그 의미는 무엇입니까? Wiki 에 설명되어 있지 않습니다. 그리고 Cheatsheet은 "빼기"를 정상적인 빼기 기호 '-'로 말합니다.'&'및 '%'는 연산자에서 - Chisel3의 &, - %, + &, + %를 의미합니까?
그럼 간단한 빼기 '-'와 퍼센트 빼기 '- %'의 차이점은 무엇입니까?
[편집]
좋아, 발견 chisel3 code 하에서 이러한 함수의 정의 : 빼기 또는 첨가의 결과가 상기의 bigest 피연산자 플러스 하나의 비트 크기가 될 것이다
// TODO: refactor to share documentation with Num or add independent scaladoc
def unary_- : UInt = UInt(0) - this
def unary_-% : UInt = UInt(0) -% this
def +& (other: UInt): UInt = binop(UInt((this.width max other.width) + 1), AddOp, other)
def + (other: UInt): UInt = this +% other
def +% (other: UInt): UInt = (this +& other) tail 1
def -& (other: UInt): UInt = binop(UInt((this.width max other.width) + 1), SubOp, other)
def - (other: UInt): UInt = this -% other
def -% (other: UInt): UInt = (this -& other) tail 1
def * (other: UInt): UInt = binop(UInt(this.width + other.width), TimesOp, other)
def * (other: SInt): SInt = other * this
def/(other: UInt): UInt = binop(UInt(this.width), DivideOp, other)
def % (other: UInt): UInt = binop(UInt(this.width), RemOp, other)
def & (other: UInt): UInt = binop(UInt(this.width max other.width), BitAndOp, other)
def | (other: UInt): UInt = binop(UInt(this.width max other.width), BitOrOp, other)
def^(other: UInt): UInt = binop(UInt(this.width max other.width), BitXorOp, other)
& 연산자로 . % operator를 사용하면 연산 결과는 가장 큰 피연산자의 크기가됩니다. normal + 또는 -와 같습니다. 그런 다음 -와 - %와 +와 + % 사이의 차이점은 무엇입니까?