From: Christiaan Baaij Date: Tue, 2 Mar 2010 16:11:57 +0000 (+0100) Subject: update higherorder cpu in the paper to correspond with the compilable version X-Git-Url: https://git.stderr.nl/gitweb?a=commitdiff_plain;h=956340a350f7a8ae4aea4bdc8a7ce291a79f9d1d;p=matthijs%2Fmaster-project%2Fdsd-paper.git update higherorder cpu in the paper to correspond with the compilable version --- diff --git "a/c\316\273ash.lhs" "b/c\316\273ash.lhs" index 2a384a0..3ac0a7c 100644 --- "a/c\316\273ash.lhs" +++ "b/c\316\273ash.lhs" @@ -1193,12 +1193,11 @@ the vectors of the \acro{FIR} code to a length of 4, is depicted in \subsection{Higher order CPU} \begin{code} -type FuState = State Word fu :: (a -> a -> a) - -> [a]:n - -> (RangedWord n, RangedWord n) - -> FuState - -> (FuState, a) + -> [a | n] + -> (Index (n - 1), Index (n - 1)) + -> a + -> (a, a) fu op inputs (addr1, addr2) (State out) = (State out', out) where @@ -1208,22 +1207,22 @@ fu op inputs (addr1, addr2) (State out) = \end{code} \begin{code} -type CpuState = State [FuState]:4 +type CpuState = State [Word | 4] + cpu :: Word - -> [(RangedWord 7, RangedWord 7)]:4 + -> [(Index 6, Index 6) | 4] -> CpuState -> (CpuState, Word) -cpu input addrs (State fuss) = - (State fuss', out) +cpu input addrs (State fuss) = (State fuss', out) where - fures = [ fu const inputs!0 fuss!0 - , fu (+) inputs!1 fuss!1 - , fu (-) inputs!2 fuss!2 - , fu (*) inputs!3 fuss!3 - ] - (fuss', outputs) = unzip fures - inputs = 0 +> 1 +> input +> outputs - out = head outputs + fures = [ fu const inputs (addrs!0) (fuss!0) + , fu (+) inputs (addrs!1) (fuss!1) + , fu (-) inputs (addrs!2) (fuss!2) + , fu (*) inputs (addrs!3) (fuss!3) + ] + (fuss', outputs) = unzip fures + inputs = 0 +> (1 +> (input +> outputs)) + out = head outputs \end{code} \section{Related work}