CacheSim/src/Main.elm

50 lines
1.2 KiB
Elm
Raw Normal View History

2019-05-27 14:08:48 -07:00
import CacheSim.Model exposing (..)
import CacheSim.Cache exposing (..)
import CacheSim.IntMap exposing (..)
2019-05-28 19:37:22 -07:00
import CacheSim.Update exposing (..)
import CacheSim.Hierarchy exposing (..)
import CacheSim.Raw exposing (..)
import CacheSim.View exposing (..)
2019-05-27 14:08:48 -07:00
import Browser exposing (Document, document)
import Html exposing (text)
testCacheModelHierarchy =
[ { blockSize = "128", setCount = "8", setSize = "1" }
]
2019-05-27 14:08:48 -07:00
init : Flags -> (Model, Cmd Msg)
init f =
let
initialModel =
{ rawHierarchy = testCacheModelHierarchy
, hierarchy = Nothing
, accessView = Nothing
}
in
(initialModel, Cmd.none)
2019-05-27 14:08:48 -07:00
view : Model -> Document Msg
view m =
{ title = "Cache Simulator"
2019-05-28 20:08:04 -07:00
, body = [ viewBase m ]
2019-05-27 14:08:48 -07:00
}
update : Msg -> Model -> (Model, Cmd Msg)
update msg m =
case msg of
2019-05-28 19:37:22 -07:00
ChangeRawModel l f -> updateChangeRawModel l f m
CreateRawModel -> updateCreateRawModel m
DeleteRawModel i -> updateDeleteRawModel i m
UseHierarchy cmh -> updateUseHierarchy cmh m
Access i -> updateAccess i m
2019-05-27 14:08:48 -07:00
subscriptions : Model -> Sub Msg
subscriptions m = Sub.none
2019-05-27 14:08:48 -07:00
main = document
{ init = init
, view = view
, update = update
, subscriptions = subscriptions
}