Skip to content

Commit

Permalink
Merge pull request SpinalHDL#325 from andreasWallner/fix_vec_onehot
Browse files Browse the repository at this point in the history
Fix check in oneHotAccess in Vec
  • Loading branch information
Dolu1990 authored May 25, 2020
2 parents 68a7a27 + 80d7faa commit 5f1af03
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions core/src/main/scala/spinal/core/Vec.scala
Original file line number Diff line number Diff line change
Expand Up @@ -223,8 +223,8 @@ class Vec[T <: Data](val dataType: HardType[T], val vec: Vector[T]) extends Mult
/** Access an element of the bector by a oneHot value */
def oneHotAccess(oneHot: Bits): T = {

if(elements.size == oneHot.getWidth){
SpinalError(s"To many bit to address the vector (${oneHot.getWidth} in place of ${elements.size})\n at\n${ScalaLocated.long}")
if(elements.size != oneHot.getWidth){
SpinalError(s"Invalid length of oneHot selection vector (${oneHot.getWidth}), not matching length of Vec (${elements.size})\n at\n${ScalaLocated.long}")
}

val ret = cloneOf(dataType)
Expand Down

0 comments on commit 5f1af03

Please sign in to comment.