scala - What does '&' and '%' mean in operators -&, -%, +&, +% in Chisel3? -


i'm trying learn chisel3 gcd example given in official web page. example use operator named -%, mean ? it's not explained on wiki operator page. , cheatsheet says "substraction" normal substraction symbol '-'.

then difference between simple substraction '-' , percent substraction '-%' ?

[edit]

ok, found definitions of these functions under chisel3 code :

 // todo: refactor share documentation num or add independent scaladoc   def unary_- : uint = uint(0) -   def unary_-% : uint = uint(0) -%   def +& (other: uint): uint = binop(uint((this.width max other.width) + 1), addop, other)   def + (other: uint): uint = +% 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 = -% 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 *   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) 

with & operator result of substraction or addition size of bigest operand plus 1 bit. % operator result of operation size of bigest operand ... normal + or -. difference between - , -% , between + +% ?

my apologies not including information on wiki operator page, add shortly.

you have hit nail on head edit: +& , -& expanding operators in width of result equal size of widest operand plus 1. +% , -% non-expanding operators in width of result equal widest operand.

+ aliases +% while - aliases -%.


Comments

Popular posts from this blog

php - How to add and update images or image url in Volusion using Volusion API -

javascript - jQuery UI Splitter/Resizable for unlimited amount of columns -

javascript - IE9 error '$'is not defined -