여기 캔자스 용암에서 다시 쓰고 싶은 요크 용암 함수가 있습니다. 하지만 일을하고 싶지 않고 실제로해야한다는 것을 모릅니다. 누군가 제발 도와 드릴까요? 지연 기능들이있다,요크 용암 함수를 캔자스 용암으로 변환
n = 3
inp = high
out = [high, low, low]
n= 5
inp = high
out = [high, low, low, low, low]
가 지금은 캔자스 용암이 쓰기 위해 노력했습니다,하지만 난 이상한 결과를 얻을 :
{-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?, 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'
올바른 출력 결과에 대해 좀 더 구체적으로 설명해 주실 수 있습니까? –
n은리스트 INP 줘야 얼마나 큰 의미 낮거나 높은 출력에서 입력 INP ++ N 배 낮은 값을 초과이다 아웃 = INP, 저, 저, 저, ..., N ] 예 : N = 2 INP = 높은 아웃 = 고, 저] 번째 예 : N = 5 INP = 로우 아웃 = [저, 저, 저 저 저] –
(1) 마지막 스 니펫이 위에 붙여 넣은 오류와 일치합니까? 나는 'CLK'에 대해'I'''가'예상 된 타입과 일치 할 수 없다'[Signal i0 Bool] '을 실제 타입'Signal clk0 a0 '으로 어떻게 특수화 하는지를 볼 수 없다. (2) GHC (i) 당신이 순간적으로 서명을 제거한다면'sipo'를 추론 할 것인가? – duplode