[Weekly Review] 2020/03/23-29

Published: by Creative Commons Licence (Last updated: )

2020/03/23-29

This week, I finished the implementation and test of CSCSwitcher, also, reread the Fuzzer.scala, and mimic it to add TileLink into my project. And I have finished the framework of the top lazy module.

Next week, I plan to finish the test and correct the implementation of Cluster Group, meanwhile finishing the middle-term report. And I will try to finish the test of Memory control module and correct the implementation logic of it.

Scala && Chisel Syntax

Intersection, Union and Complement

Sample Data

scala> val low = 1 to 5 toSet
low: scala.collection.immutable.Set[Int] = Set(5, 1, 2, 3, 4)

scala> val medium = (3 to 7).toSet
medium: scala.collection.immutable.Set[Int] = Set(5, 6, 7, 3, 4)

Intersection

scala> val i = low.intersect(medium)
i: scala.collection.immutable.Set[Int] = Set(5, 3, 4)

Union

scala> val uniq = low.union(medium)
uniq: scala.collection.immutable.Set[Int] = Set(5, 1, 6, 2, 7, 3, 4)

Complement

scala> val diff = low.diff(medium)
diff: scala.collection.immutable.Set[Int] = Set(1, 2)

scala> val diff = medium.diff(low)
diff: scala.collection.immutable.Set[Int] = Set(6, 7)

ScalaDoc Tags

Scaladoc comments go before the items they pertain to in a special comment block that starts with a /** and ends with a */.

Some common tags

Tag Description Number allowed
@author The author of the class. Multiple tags are allowed.
@constructor Documentation you want to provide for the constructor. One (does not currently work on auxiliary constructors)
@example Provide an example of how to use a method or constructor. Multiple
@note Document pre- and post-conditions, and other requirements. Multiple
@param Document a method or constructor parameter. One per parameter
@return Document the return value of a method. One
@see Describe other sources of related information. Multiple
@since Used to indicate that a member has been available since a certain version release. One
@todo Document “to do” items for a method or class. Multiple
@throws Document an exception type that can be thrown by a method or constructor. Multiple
@version The version of a class. One

Character formatting tags

Format Tag example
Bold '''foo'''
Italic ''foo''
Monospace (fixed-width) \foo``
Subscript ,,foo,,
Superscript ^foo^
Underline __foo__

Link:

Link Type Tag example
Link to a Scala type [[scala.collection.immutable.List]]
Link to an external web page [[http://alvinalexander.com My website]]

Paragraph formatting tags

Format Tag example
Headings =heading1= ==heading2== ===heading3===
New paragraph A blank line starts a new paragraph
Source code block // all on one line {{{ if (foo) bar else baz }}} // multiple lines {{{ val p = Person("Al", 42) p.name p.age }}}

Print Log Info with Color

println(Console.RED + s"[Error] there is no difference between reqList and respList" + Console.RESET)

RED_B means the background color. Remember to reset the console every time you use it.

It has the following colors:

  • BLACK
  • BLUE
  • CYAN
  • GREEN
  • MAGENTA
  • RED
  • WHITE
  • YELLOW

And can also use UNDERLINED, BOLD to give the log info some styles.

See AIP document for more details.

The width of UInt in RegInit

In my design, I forgot to assign the width of UInt in RegInit, so in the example:

private val vectorNumCounter = RegInit(0.U)

It only has one bit, so it can only count for zero and one.

private val vectorNumCounter = RegInit(0.U(lgVectorNum.W))