From 9c78ac4d7833e6c41be01e0dae8f668777e22b32 Mon Sep 17 00:00:00 2001 From: Andrew Waterman Date: Wed, 21 Jun 2017 01:35:41 -0700 Subject: [PATCH] Add grouped method to AugmentedUInt, like Seq.grouped --- src/main/scala/util/Package.scala | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/scala/util/Package.scala b/src/main/scala/util/Package.scala index 33907996..ec9fe0e1 100644 --- a/src/main/scala/util/Package.scala +++ b/src/main/scala/util/Package.scala @@ -57,6 +57,9 @@ package object util { else x(hi, lo) } + def grouped(width: Int): Seq[UInt] = + (0 until x.getWidth by width).map(base => x(base + width - 1, base)) + def inRange(base: UInt, bounds: UInt) = x >= base && x < bounds }