2016-11-08 16 views
2

私はofficial web pageで与えられたGCDの例でChisel3を学ぼうとしています。この例では、 - %という名前の演算子を使用していますが、それはどういう意味ですか? これはWiki で説明されていません。 Cheatsheetは、通常の減算記号「 - 」として「減算」を示します。Chisel3の&、 - %、+&、+%の演算子で '&'と '%'はどういう意味ですか?

次に、単純減算 ' - 'とパーセント減算 ' - %'の違いは何ですか?

[編集]

[OK]を、私が見つかりました。chisel3 code下でこれらの関数の定義:substraction又は加算の結果が一番大きなオペランドプラス1ビットの大きさであろう

// 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) 

&オペレータと。 %演算子では、演算結果は通常の+または - のように最も大きいオペランドのサイズになります。次に、 - と - %との差は+ an +%の間ですか?

答えて

2

この情報をWikiオペレータページに含めないことをお詫び申し上げます。まもなく追加します。

あなたが編集して頭の上に釘を打ってきた。その結果の幅は最も広いオペランドのサイズと同じであることに+&-&は、事業者を拡大しているプラ​​ス1 +%-%は非拡大事業者であります結果の幅が最も広いオペランドと等しいことを意味する。

++%へのエイリアスだけでなく、-エイリアス-%へのエイリアス。

関連する問題