我在这里有一个约克熔岩函数,我想在堪萨斯熔岩中重写。但它不想工作,我不知道我应该这样做。有人可以帮我吗?
{-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]
现在我试图在堪萨斯熔岩中写这个,它们是一个延迟函数,但我得到了奇怪的结果。下面的代码生成了我,其参数与第一个示例相同:
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'