Wed Jul 25 19:43:44 EDT 2018
SeqTH / SeqPrim
Boring and straightforward to write, but I think I got it.
Very simple in structure, lots of different types and conversions.
Next is to put this in the test script. Done.
Next is to implement all the primitives.
EDIT: Got prims for uart test, but don't get the correct result.
Trying some ad-hoc tests and they seem fine:
m3 = do
-- Some ad-hoc tests for SeqTH,SeqPrim combo.
let test p = print $ SeqTH.run p $ map (:) [0..9]
test $(SeqTH.compile  $ \[i] -> do c <- counter $ bits 3 ; return [c])
test $(SeqTH.compile  $ \[i] -> do c <- integral i ; return [c])
test $(SeqTH.compile  $ \[i] -> do c <- conc i (constant $ bits 1) ; return [c])
test $(SeqTH.compile  $ \[i] -> do c <- slice i (Just 4) 1 ; return [c])
EDIT: Following the types too much. I think the inputs are not in the
EDIT: That doesn't seem to be the problem.
running x_async_receiver_sample' it seems that the internal state
machine is fine, going through the proper bit framing, but the sample
pulse is missing so the shift register never triggers.
here's a discrepancy:
r5 = seqSLICE (seqInt 6) r3 (seqInt 0);
r7 = seqEQU (seqInt 1) r5 (seqInt 0);
I beleive r5 is from:
phase <- slice count (Just 3) 0
The bit size is not correct.
The bug is likely in SeqTerm
slice (R a) b c =
fmap R $ driven $ Slice (combTypes [a]) a b c
combTypes is not correct here.
also for CONC the sizes are different.
EDIT: I think I got it now.
Doing SeqTH is a good thing: it allows SeqTerm to be debugged without
doing this through MyHDL tests.
One more issue:
test-seq: Seq.sizeError: (IF,Just 2,Just 2,Just 2)
CallStack (from HasCallStack):
error, called at ./SeqTerm.hs:169:23 in main:SeqTerm
Test suite test-seq: FAIL
Test suite logged to: /dev/stdout
Just a bug in the test.
EDIT: uart quickcheck passes