Github render test
This commit is contained in:
parent
f32d674616
commit
3b635be2dc
5 changed files with 31 additions and 194 deletions
|
|
@ -8,7 +8,7 @@ import chisel3.util.ListLookup
|
|||
* This module is mostly done, but you will have to fill in the blanks in opcodeMap.
|
||||
* You may want to add more signals to be decoded in this module depending on your
|
||||
* design if you so desire.
|
||||
*
|
||||
*
|
||||
* In the "classic" 5 stage decoder signals such as op1select and immType
|
||||
* are not included, however I have added them to my design, and similarily you might
|
||||
* find it useful to add more
|
||||
|
|
@ -36,12 +36,12 @@ class Decoder() extends Module {
|
|||
val Y = 1.asUInt(1.W)
|
||||
|
||||
/**
|
||||
* In scala we sometimes (ab)use the `->` operator to create tuples.
|
||||
* In scala we sometimes (ab)use the `->` operator to create tuples.
|
||||
* The reason for this is that it serves as convenient sugar to make maps.
|
||||
*
|
||||
*
|
||||
* This doesn't matter to you, just fill in the blanks in the style currently
|
||||
* used, I just want to demystify some of the scala magic.
|
||||
*
|
||||
*
|
||||
* `a -> b` == `(a, b)` == `Tuple2(a, b)`
|
||||
*/
|
||||
val opcodeMap: Array[(BitPat, List[UInt])] = Array(
|
||||
|
|
|
|||
|
|
@ -136,18 +136,18 @@ object TestRunner {
|
|||
events match {
|
||||
|
||||
// Scala syntax for matching a list with a head element of some type and a tail
|
||||
// `case h :: t =>`
|
||||
// means we want to match a list with at least a head and a tail (tail can be Nil, so we
|
||||
// essentially want to match a list with at least one element)
|
||||
// h is the first element of the list, t is the remainder (which can be Nil, aka empty)
|
||||
// `case h :: t =>`
|
||||
// means we want to match a list with at least a head and a tail (tail can be Nil, so we
|
||||
// essentially want to match a list with at least one element)
|
||||
// h is the first element of the list, t is the remainder (which can be Nil, aka empty)
|
||||
|
||||
// `case Constructor(arg1, arg2) :: t => `
|
||||
// means we want to match a list whose first element is of type Constructor, giving us access to its internal
|
||||
// values.
|
||||
// `case Constructor(arg1, arg2) :: t => `
|
||||
// means we want to match a list whose first element is of type Constructor, giving us access to its internal
|
||||
// values.
|
||||
|
||||
// `case Constructor(arg1, arg2) :: t => if(p(arg1, arg2))`
|
||||
// means we want to match a list whose first element is of type Constructor while satisfying some predicate p,
|
||||
// called an if guard.
|
||||
// `case Constructor(arg1, arg2) :: t => if(p(arg1, arg2))`
|
||||
// means we want to match a list whose first element is of type Constructor while satisfying some predicate p,
|
||||
// called an if guard.
|
||||
case Taken(from, to) :: t if( predictionTable(from)) => helper(t, predictionTable)
|
||||
case Taken(from, to) :: t if(!predictionTable(from)) => 1 + helper(t, predictionTable.updated(from, true))
|
||||
case NotTaken(addr) :: t if( predictionTable(addr)) => 1 + helper(t, predictionTable.updated(addr, false))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue