ucb-bar / dsptools

A Library of Chisel3 Tools for Digital Signal Processing
Apache License 2.0
220 stars 38 forks source link

PaperProject Details #112

Open chick opened 6 years ago

chick commented 6 years ago

Branches

project branch
firrtl intervals
chisel3 interval-type-2
firrtl-interpreter instrumenting-sizes
shunshou commented 6 years ago

Branches I'm using (based off the above):

Branches

project branch
firrtl intervals-oct
chisel3 interval-oct
firrtl-interpreter ???
shunshou commented 6 years ago

@chick can you make sure ops like the ones in https://github.com/ucb-bar/dsptools/tree/master/src/main/scala/dsptools/numbers are also supported? i.e. <<, >> not implemented:

scala.NotImplementedError: an implementation is missing [info] at scala.Predef$.$qmark$qmark$qmark(Predef.scala:225) [info] at chisel3.internal.firrtl.IntervalRange.$less$less(IR.scala:359)

chick commented 6 years ago

Working on it. Is there general agreement on what it means. I would guess for shift that:

And what about merge. Not mentioned in Wikipedia Intervals My instinct would be:

Or maybe more naively

@shunshou , @azidar @grebe Your thoughts?

shunshou commented 6 years ago

So two things:

1) We need to look at how Adam's firrtl code does this -- probably would be useful to have Adam document user-facing features; or that might already be in his tests.

2) For dsptools:

a >> n Arithmetic shift right where n is either Int or UInt Note: precision loss will result since the decimal point location is not adjusted

AND

a.div2(n) a/2^n UInt: Consistent with a >> n (i.e. rounds 1/2 to 0) SInt: Round output to nearest SInt via DspContext.trimType FixedPoint: Adjusts decimal point; up to you how much precision to keep via DspContext.trimType and DspContext.binaryPointGrowth (adds more fractional bits on top of the input amount) For both FixedPoint and SInt, again, be aware of overflow behavior when RoundHalfUp is used for the most positive input

^ Both should be eventually supported (but not necessarily in Chisel; can be in dsptools).

What is merge?

It seems like, for example, with multiply, you were intending to have firrtl infer everything if uninferred i.e. maybe the naive approach?

Are we going at this expecting that Chisel basically should have no knowledge of intervals besides the ones that are user assigned and letting firrtl take care of pretty much everything?

shunshou commented 6 years ago

Also, fyi, I pushed more changes to aforementioned branches to fix some bugs.

chick commented 6 years ago

I added the unimplemented shift functions IntervalRange and Interval. I need to add more tests but I wanted to get the implementations out there first. I left merge() in as unimplemented. Not sure what it is intended for.

chick commented 6 years ago

And yes, I believe @azidar thought the naive approach of anything not simple with intervals should be deferred to Firrtl as best for now.

shunshou commented 6 years ago

Ok then beyond that, the ops that should take precedence are clip, wrap, etc. (overflow behavior and truncation/round, etc.). After that, I think we're good for being able to try some more complicated legitimate hardware...

I will also add some tests... (but in my FFT repo for now)

shunshou commented 6 years ago

Here are the ops Adam checked in IntervalMathSpec:

+
*
-
>, >=, <, <=, ===, =/=
>> int
<< int
<< uint
>> uint
[]()
arith assign?
cat

Is cat something built into the type in Chisel or an external helper? o_O Otherwise, assuming the dynamic/static shifts work, I think we've covered all of our bases there.

shunshou commented 6 years ago

And as far as the rest of Adam's non-math tests, really it's:

Cannot defined unknown BP for interval (Chisel restriction) -- just my note

wrap clip


Is there a setBinaryPoint equivalent for Interval? That might be more necessary for stuff like rounding ops.

grebe commented 6 years ago

I can't find a reference to merge in our doc. @chick, your instinct matches mine, but I'm still trying to think of why it would be useful.

chick commented 6 years ago

@shunshou @azidar are there any explicit docs on clip, wrap, etc. I am working from what I can see in intervals-oct, but any other materials would be useful

chick commented 6 years ago

@shunshou I've pushed naive wrap and clip to chisel3 intervals-oct, they don't really figure anything out right now. just make things Unknown so firrtl can figure it all out. I need to talk to Adam to proceed on this.

Also I did not see a problem with running the interpreter's instrumenting-sizes branch with the intervals-oct branches of firrtl and chisel3, if you have an example can you pass it to me

shunshou commented 6 years ago

Yeah, so Adam's super busy this week--he asked to reschedule our meeting (will send out an email shortly), but if he has a few minutes to meet with you tomorrow to discuss next steps, that'd be great. The one thing I'd like to see is being able to do clip based off of some other signal's range * # of loops, as an example, to handle: multiply by a constant and accumulate. I'll test firrtl-interpreter again with various branches and copy+paste the error I get in a few minutes.

shunshou commented 6 years ago

Also, are you on the same branch of chisel-testers/dsptools as I am? Note: the last working verison of firrtl-interpreter is 5dd2f5b When I switch over to firrtl-interpreter/instrumenting-sizes, and I try to re-publish-local chisel-testers with hash cb82340, I get:

[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:130: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.ReplOptionsManager)
[error]  required: firrtl_interpreter.InterpreterOptionsManager with firrtl_interpreter.HasReplConfig
[error]         FirrtlRepl.execute(optionsManager)
[error]                            ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:130: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.ReplOptionsManager)
[error]  required: firrtl_interpreter.InterpreterOptionsManager with firrtl_interpreter.HasReplConfig
[error]         FirrtlRepl.execute(optionsManager)
[error]                            ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala:14: type mismatch;
[error]  found   : chisel3.iotesters.TesterOptionsManager
[error]  required: firrtl_interpreter.HasInterpreterSuite
[error]   val interpretiveTester = new InterpretiveTester(firrtlIR, optionsManager)
[error]                                                             ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala:14: type mismatch;
[error]  found   : chisel3.iotesters.TesterOptionsManager
[error]  required: firrtl_interpreter.HasInterpreterSuite
[error]   val interpretiveTester = new InterpretiveTester(firrtlIR, optionsManager)

If you are on a better version of chisel-testers (and corresponding dsptools), please let me know!

chick commented 6 years ago

@azidar all the wrap cases I did made sense except for

  val base = Wire(Interval(range"[-4, 6]"))
  val disjointRight = Wire(Interval(range"[7,11]"))
  val w6 = base.wrap(disjointRight)
  assert(w6 === 10.I())  // FAILS says it should be 6.U
                                       // even though derived interval is disjointRight Closed(7) Closed(11)

Any ideas

shunshou commented 6 years ago

Before you delve too deep into this, as a basic use case, I just want to see that val base = Wire(Interval(range"[0, 9]")) val out = base.wrap(range"[0,7]") base := 9.I --> out == 1.I without any mux logic. That's the most common use-case for wrap. Does that work?

chick commented 6 years ago

@shunshou I'll need to change chisel-testers to fix its publishLocal problems with the instrumenting-sizes branch of firrtl-interpreter. Can there be a intervals-oct branch of chisel-testers that I can make my changes in. I'm not sure what to do with cb82340

shunshou commented 6 years ago

yea go for it--make a branch and i'll point my stuff to it. thanks!! :D

chick commented 6 years ago

@shunshou pushed my latest wrap stuff to intervals-oct. This includes wrap(that: IntervalRange) which lets you say myInterval.wrap(range"[-4, 11)") if you are inclined to say such things Will try to do clip next

chick commented 6 years ago

@shunshou just pushed intervals-oct branch with interpreter fixes for instrumenting-sizes branch. It's based on the cb82340 (I hope that's ok) this builds for me, hope it works for you

shunshou commented 6 years ago

Hmm... I get Can you report latest hashes of everything so I can double check?

] Executing in batch mode.
[warn]   For better performance, hit [ENTER] to switch to interactive mode, or
[warn]   consider launching sbt without any commands, or explicitly passing 'shell'
[info] Loading project definition from /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/project
[info] Set current project to Chisel.iotesters (in build file:/Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/)
[info] Packaging /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/target/scala-2.11/chisel-iotesters_2.11-1.2-SNAPSHOT-sources.jar ...
[info] Done packaging.
[info] Main Scala API documentation to /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/target/scala-2.11/api...
[info] Wrote /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/target/scala-2.11/chisel-iotesters_2.11-1.2-SNAPSHOT.pom
[info] :: delivering :: edu.berkeley.cs#chisel-iotesters_2.11;1.2-SNAPSHOT :: 1.2-SNAPSHOT :: integration :: Mon Oct 16 21:58:03 PDT 2017
[info]  delivering ivy file to /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/target/scala-2.11/ivy-1.2-SNAPSHOT.xml
[info] Compiling 20 Scala sources to /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/target/scala-2.11/classes...
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/ChiselPokeSpec.scala:15: type mismatch;
[error]  found   : options.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]     setupFirrtlTerpBackend(dutGen, options)
[error]                                    ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/ChiselPokeSpec.scala:15: type mismatch;
[error]  found   : options.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]     setupFirrtlTerpBackend(dutGen, options)
[error]                                    ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:51: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]             setupFirrtlTerpBackend(dutGenerator, optionsManager)
[error]                                                  ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:60: type mismatch;
[error]  found   : Any
[error]  required: chisel3.iotesters.Backend
[error]         backendVar.withValue(Some(backend)) {
[error]                                   ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:62: type mismatch;
[error]  found   : dut.type (with underlying type Any)
[error]  required: T
[error]             testerGen(dut).finish
[error]                       ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:130: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.ReplOptionsManager)
[error]  required: firrtl_interpreter.InterpreterOptionsManager with firrtl_interpreter.HasReplConfig
[error]         FirrtlRepl.execute(optionsManager)
[error]                            ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:51: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]             setupFirrtlTerpBackend(dutGenerator, optionsManager)
[error]                                                  ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:60: type mismatch;
[error]  found   : Any
[error]  required: chisel3.iotesters.Backend
[error]         backendVar.withValue(Some(backend)) {
[error]                                   ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:62: type mismatch;
[error]  found   : dut.type (with underlying type Any)
[error]  required: T
[error]             testerGen(dut).finish
[error]                       ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:130: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.ReplOptionsManager)
[error]  required: firrtl_interpreter.InterpreterOptionsManager with firrtl_interpreter.HasReplConfig
[error]         FirrtlRepl.execute(optionsManager)
[error]                            ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala:12: type mismatch;
[error]  found   : chisel3.iotesters.TesterOptionsManager
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]     optionsManager: TesterOptionsManager with HasInterpreterSuite = new TesterOptionsManager)
[error]                                                                     ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala:106: type mismatch;
[error]  found   : chisel3.iotesters.TesterOptionsManager
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]       optionsManager: TesterOptionsManager with HasInterpreterSuite = new TesterOptionsManager): (T, Backend) = {
[error]                                                                       ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala:12: type mismatch;
[error]  found   : chisel3.iotesters.TesterOptionsManager
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]     optionsManager: TesterOptionsManager with HasInterpreterSuite = new TesterOptionsManager)
[error]                                                                     ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/FirrtlTerpBackend.scala:106: type mismatch;
[error]  found   : chisel3.iotesters.TesterOptionsManager
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
chick commented 6 years ago

@shunshou just pushed clip (saturate) operator for intervals BTW Aaaargh, on weird errors with testers, I'll try to reproduce

shunshou commented 6 years ago

Thx! Finally have a ~10 pg outline of the ~6 pg paper. :P Will look into this after I'm done drafing background + intro hopefully...

chick commented 6 years ago

Hmnm, I am building with (cd firrtl ; git status | grep 'On branch') On branch intervals-oct (cd firrtl-interpreter ; git status | grep 'On branch') On branch instrumenting-sizes (cd chisel3 ; git status | grep 'On branch') On branch intervals-oct (cd chisel-testers ; git status | grep 'On branch') On branch intervals-oct (cd dsptools ; git status | grep 'On branch') On branch master

shunshou commented 6 years ago

@chick, I'm still getting:

error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/ChiselPokeSpec.scala:15: type mismatch;
[error]  found   : options.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]     setupFirrtlTerpBackend(dutGen, options)
[error]                                    ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/ChiselPokeSpec.scala:15: type mismatch;
[error]  found   : options.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]     setupFirrtlTerpBackend(dutGen, options)
[error]                                    ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:51: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]             setupFirrtlTerpBackend(dutGenerator, optionsManager)
[error]                                                  ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:60: type mismatch;
[error]  found   : Any
[error]  required: chisel3.iotesters.Backend
[error]         backendVar.withValue(Some(backend)) {
[error]                                   ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:62: type mismatch;
[error]  found   : dut.type (with underlying type Any)
[error]  required: T
[error]             testerGen(dut).finish
[error]                       ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:130: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.ReplOptionsManager)
[error]  required: firrtl_interpreter.InterpreterOptionsManager with firrtl_interpreter.HasReplConfig
[error]         FirrtlRepl.execute(optionsManager)
[error]                            ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:51: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.TesterOptionsManager)
[error]  required: chisel3.iotesters.TesterOptionsManager with firrtl_interpreter.HasInterpreterSuite
[error]             setupFirrtlTerpBackend(dutGenerator, optionsManager)
[error]                                                  ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:60: type mismatch;
[error]  found   : Any
[error]  required: chisel3.iotesters.Backend
[error]         backendVar.withValue(Some(backend)) {
[error]                                   ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:62: type mismatch;
[error]  found   : dut.type (with underlying type Any)
[error]  required: T
[error]             testerGen(dut).finish
[error]                       ^
[error] /Users/angie.wang/Chisel3FFAST/Chisel3DSPDependencies/chisel-testers/src/main/scala/chisel3/iotesters/Driver.scala:130: type mismatch;
[error]  found   : optionsManager.type (with underlying type chisel3.iotesters.ReplOptionsManager)
[error]  required: firrtl_interpreter.InterpreterOptionsManager with firrtl_interpreter.HasReplConfig
[error]         FirrtlRepl.execute(optionsManager)

with the branches you've pointed me to :(

chick commented 6 years ago

Still trying to get this Maybe now (had to push to interpreter and testers) firrtl 3abda10e5e82b481f58c73adf26c48678e496574 firrtl-interpreter 4f0c623ad03b1b7f5c484aa99575ea324d8cdfbd chisel3 14cc99a8880ba2ee735f888cec70c7cc99235a4b chisel-testers 496bd86063b9a47a0bb13264068efdf94bd98a66

shunshou commented 6 years ago

Yay looks like i was able to sbt publish-local everything this time around, but dsptools still needs editing :( --

(When I run FFT-local tests):

java.lang.NoSuchMethodError: firrtl_interpreter.InterpreterOptions.copy(ZZZZZJLscala/collection/Seq;JZZ)Lfirrtl_interpreter/InterpreterOptions;
    at dsptools.Driver$$anonfun$execute$1.apply$mcZ$sp(Driver.scala:27)
    at dsptools.Driver$$anonfun$execute$1.apply(Driver.scala:26)
    at dsptools.Driver$$anonfun$execute$1.apply(Driver.scala:26)
    at scala.util.DynamicVariable.withValue(DynamicVariable.scala:58)
    at dsptools.Driver$.execute(Driver.scala:26)
    at dsptools.intervals.tests.BasicIASpec$$anonfun$2.apply(BasicIA.scala:134)
    at dsptools.intervals.tests.BasicIASpec$$anonfun$2.apply(BasicIA.scala:135)
    at org.scalatest.OutcomeOf$class.outcomeOf(OutcomeOf.scala:85)
    at org.scalatest.OutcomeOf$.outcomeOf(OutcomeOf.scala:104)
    at org.scalatest.Transformer.apply(Transformer.scala:22)
    at org.scalatest.Transformer.apply(Transformer.scala:20)
    at org.scalatest.FlatSpecLike$$anon$1.apply(FlatSpecLike.scala:1682)
    at org.scalatest.TestSuite$class.withFixture(TestSuite.scala:196)
    at org.scalatest.FlatSpec.withFixture(FlatSpec.scala:1685)
    at org.scalatest.FlatSpecLike$class.invokeWithFixture$1(FlatSpecLike.scala:1679)
    at org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1692)
    at org.scalatest.FlatSpecLike$$anonfun$runTest$1.apply(FlatSpecLike.scala:1692)
    at org.scalatest.SuperEngine.runTestImpl(Engine.scala:289)
    at org.scalatest.FlatSpecLike$class.runTest(FlatSpecLike.scala:1692)
    at org.scalatest.FlatSpec.runTest(FlatSpec.scala:1685)
    at org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1750)
    at org.scalatest.FlatSpecLike$$anonfun$runTests$1.apply(FlatSpecLike.scala:1750)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:396)
    at org.scalatest.SuperEngine$$anonfun$traverseSubNodes$1$1.apply(Engine.scala:384)
    at scala.collection.immutable.List.foreach(List.scala:381)
    at org.scalatest.SuperEngine.traverseSubNodes$1(Engine.scala:384)
chick commented 6 years ago

@shunshou What's the branch of dsptools

shunshou commented 6 years ago

I assumed you were on master, so I switched to that (but that's probably just not compatible w/ old stuff...).

shunshou commented 6 years ago

Follow up @chick @grebe

https://github.com/ucb-art/Chisel3DSPDependencies/tree/ranges (range branch!) points to stuff that should hopefully work now:

firrtl: intervals-oct chisel3: intervals-oct firrtl-interpreter: instrumenting-sizes chisel-testers: intervals-oct dsptools: intervals-oct

(Note: not sure if the default versions of chisel3/chisel-testers need updating in build.sbt? -- more generally; not for this particular issue).

shunshou commented 6 years ago

@chick bpsl, bpsr, bpset should also be implemented in chisel, if it hasn't already.

chick commented 6 years ago

I have just pushed to intervals-oct new methods on Interval .setBinaryPoint(that: Int) .shiftLeftBinaryPoint(that: Int) .shiftRightBinaryPoint(that: Int) I am not sure they are implemented exactly right, I need to check with Adam, but you can start to try them

shunshou commented 6 years ago

Cool. I'm still in the process of debugging some of the shifts... Adam and I will be having a working meeting today ~1 to maybe up to 3ish? We should just clean out these details and make basic tests for everything while people are here... :o

chick commented 6 years ago

@shunshou I had to push some small changes to instrumenting-sizes branch of the interpreter. I wrote up a little bit here Instrumenting signals

chick commented 6 years ago

I have started a documentation page on chisel3 wiki for Intervals

shunshou commented 6 years ago

Ok, I'm still debugging some intermediate shr weirdness -- doesn't seem like I'm getting the right answer when I'm shifting by less than the width either :\, but need to finish up slides for another conference tonight. Thanks for starting the intervals documentation :D

shunshou commented 6 years ago

@chick what implications are there if chisel range inference is wrong? (and firrtl is right?)

chick commented 6 years ago

It would imply to me that things are broken. In general, @azidar and I have tried to match the firrtl behavior, and in many cases actually use the firrtl code generate answers when we can. I think there a number of cases where chisel might defer to firrtl, by just leaving things unknown so firrtl will figure it out, but it shouldn't contradict it

shunshou commented 6 years ago

OK. I went ahead and double checked stuff and made things unknown wherever I felt there was a contradiction... Still not quite at the point of passing enough of my own tests, but getting closer.

shunshou commented 6 years ago

@chick -- looks like x.clip(uint/sint) and x.wrap(uint/sint) don't work. Namely, there's no firrtl PrimOp that operates on 1 Interval and 1 UInt/SInt type... I thought I could handle this at the Chisel level by first doing asInterval on the UInt -- when the width is known, everything's good... unfortunately, when the width is unknown, I don't think there's any mechanism to pass the unknown (?) through from the Chisel emitter... [at least for asInterval?].

chick commented 6 years ago

Hmm, it looks to me like x.wrap(sint) might be a problem, but the rest of the family convert the argument to an interval before passing down to firrtl. But clearly I need to expand the tests to include use of the SInt and UInt versions of clip and wrap, also to add tests for all these with some arguments with unknown ranges. Sorry, but it's going to be later tonight before I can get to it.

shunshou commented 6 years ago

Hm ok I made some changes assuming known UInt and SInt. I'm making my own tests for them locally (basically assuming my model is intended behavior). If you can generalize to handle unknown ranges, that'd be great. Also, looks like some of my changes broke some of your tests. I made some of them based off of my understanding of how functions should operate (from various discussions), so we should make sure our understandings of behaviors match and better document.

On Sunday, October 22, 2017, Chick Markley notifications@github.com wrote:

Hmm, it looks to me like x.wrap(sint) might be a problem, but the rest of the family convert the argument to an interval before passing down to firrtl. But clearly I need to expand the tests to include use of the SInt and UInt versions of clip and wrap, also to add tests for all these with some arguments with unknown ranges. Sorry, but it's going to be later tonight before I can get to it.

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/ucb-bar/dsptools/issues/112#issuecomment-338507325, or mute the thread https://github.com/notifications/unsubscribe-auth/AGTTFl1oN83VZZ82hlcQqV4k6qHLIzk-ks5su6figaJpZM4PzGSp .

shunshou commented 6 years ago

FYI--when adding tests, it's important to test stuff that's not just integers. Running into annoying binary point alignment problems, etc.

shunshou commented 6 years ago

@chick to save me some time of trying to figure this out -- can you make a toy example for how firrtl interpreter stuff works with the driver in DspTools? (Likely stuff will need modification?)

chick commented 6 years ago

Almost got it working, but found some edge case problems :-(.

shunshou commented 6 years ago

no worries. i'm still trying to get accumulate working. :\ slow process...

shunshou commented 6 years ago

Re: Interpreter --

I think we agreed on trimming widths based on some n sigma criteria or min/max. The other thing that's useful is that, if we're trimming based off of sigma, it should be trim and optionally clip to maximum.

chick commented 6 years ago

The toy example works with my latest push/merges to firrtl-interpreter and dsptools on intervals-oct branches See InstrumentingSpec for how. Time to start working on feedback system

shunshou commented 6 years ago

Yay! OK. I will try to run the interpreter on my interval arithmetic testbench and get back to you.