-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathMain.hs
More file actions
72 lines (50 loc) · 1.76 KB
/
Main.hs
File metadata and controls
72 lines (50 loc) · 1.76 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE DataKinds #-}
{-# LANGUAGE TypeOperators #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE TemplateHaskell #-}
module Main where
import CLaSH.Prelude
import CLaSH.Sized.Unsigned
import Language.Haskell.TH
import CLaSH.Promoted.Nat
import Types
import SevenSeg
-- import Cpu
import Cpu2
import qualified Data.List as L
-- declare d65536
$(decLiteralD 65536)
$(decLiteralD 65012)
{-# ANN topEntity
(TopEntity
{ t_name = "main"
, t_inputs = []
, t_outputs = ["SS_ANODES", "SS_SEGS"]
, t_extraIn = [ ("CLOCK_32", 1)
]
, t_extraOut = []
, t_clocks = [ (clockWizard "clkwiz50"
"CLOCK_32(0)"
"'0'")
]
}) #-}
topEntity :: Signal (BitVector 4, BitVector 8)
topEntity = ss where
ss = sevenSegA (resize . prPC <$> system)
ram64K :: Signal Addr -> Signal Bool -> Signal Byte -> Signal Byte
-- ram64K addr wrEn dataIn = blockRamPow2 testRAMContents addr addr wrEn dataIn
ram64K addr wrEn dataIn = unpack <$> blockRamFilePow2 "utils/6502_functional_test.bin" (unpack <$> addr) (unpack <$> addr) wrEn (pack <$> dataIn)
-- system :: Signal CpuProbes
-- system = probes where
-- (out, probes) = unbundle $ cpuA $ (CpuIn <$> din)
-- adr = (resize . addr) <$> out :: Signal (Unsigned 16)
-- din = ram64K adr (writeEn <$> out) (dataOut <$> out)
system :: Signal Probes
system = probes where
(out, probes) = unbundle $ cpuM $ (CpuIn <$> din)
adr = (resize . addr) <$> out :: Signal (Addr)
din = ram64K adr (writeEn <$> out) (dOut <$> out)
-- Note we have to drop 1 because the initial state of dIn is undefined
runSystem = putStr $ unlines $ L.map (show) $L.drop 1 (sampleN 75000000 system)
main = runSystem