ここには、Kansas Lava で書き直したい York Lava 関数があります。しかし、それはうまくいきたくないので、実際にやるべきかわかりません。誰かがこれで私を助けてくれますか?
{-Serial In - Parallel Out shiftregister. The serial bit is inserted at
the least significant bit position. The data is shifted LSB -> MSB
each and every clock cycle-}
sipo :: Int -- ^ The number of bits in the output word.
-> Bit -- ^ The input bit.
-> [Bit] -- ^ The output word.
sipo 1 inp = [inp]
sipo n inp = inp : rest
where
inp' = delay low inp
rest = sipo (n-1) inp'
上記の関数により、いくつかの例でこれらの正しい結果が得られます。
n = 3
inp = high
out = [high, low, low]
n= 5
inp = high
out = [high, low, low, low, low]
これをカンザス溶岩で書き込もうとしましたが、これは遅延関数ですが、奇妙な結果が得られます。以下のコードは、最初の例と同じパラメータで me を生成します。
n = 3
inp = high
out = [high?, high., high!] (don't know what that means)
sipo :: (Clock clk)
=> Int -- ^ The number of bits in the output word.
-> Signal clk Bool -- ^ The input bit.
-> [Signal clk Bool] -- ^ The output word.
sipo 1 inp = [inp]
sipo n inp = inp : rest
where
inp' = delay inp
rest = sipo (n-1) inp'