Skip to content

Commit

Permalink
Split SimulationView, rename Extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
tomcl committed Aug 31, 2024
1 parent 01acfef commit 5c49155
Show file tree
Hide file tree
Showing 19 changed files with 310 additions and 285 deletions.
2 changes: 1 addition & 1 deletion src/Renderer/Interface/FilesIO.fs
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ let checkMemoryContents (projectPath:string) (comp: Component) : Component =
/// load a component from its canvas and other elements
let makeLoadedComponentFromCanvasData (canvas: CanvasState) filePath timeStamp waveInfo (sheetInfo:SheetInfo option) =
let projectPath = dirName filePath
let inputs, outputs = Extractor.parseDiagramSignature canvas
let inputs, outputs = CanvasExtractor.parseDiagramSignature canvas
//printfn "parsed component"
let comps,conns = canvas
let comps' = List.map (checkMemoryContents projectPath) comps
Expand Down
4 changes: 2 additions & 2 deletions src/Renderer/Playground.fs
Original file line number Diff line number Diff line change
Expand Up @@ -283,8 +283,8 @@ module Misc =


let highLightChangedConnections dispatch =
dispatch (Sheet (SheetT.Msg.SelectWires Extractor.debugChangedConnections))
Extractor.debugChangedConnections <- []
dispatch (Sheet (SheetT.Msg.SelectWires CanvasExtractor.debugChangedConnections))
CanvasExtractor.debugChangedConnections <- []

module Memory =
open Fable.Core
Expand Down
3 changes: 2 additions & 1 deletion src/Renderer/Renderer.fsproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<Compile Include="Simulator\SimulatorTypes.fs" />
<Compile Include="Simulator\TruthTableTypes.fs" />
<Compile Include="Simulator\NumberHelpers.fs" />
<Compile Include="Simulator\Extractor.fs" />
<Compile Include="Simulator\CanvasExtractor.fs" />
<Compile Include="Simulator\SynchronousUtils.fs" />
<Compile Include="Simulator\CanvasStateAnalyser.fs" />
<Compile Include="Simulator\GraphBuilder.fs" />
Expand Down Expand Up @@ -96,6 +96,7 @@
<Compile Include="UI\TopMenuView.fs" />
<Compile Include="UI\CustomCompPorts.fs" />
<Compile Include="UI\SimulationView.fs" />
<Compile Include="UI\StepSimulationTop.fs" />
<Compile Include="UI\TruthTable\TruthTableReduce.fs" />
<Compile Include="UI\TruthTable\TruthTableCreate.fs" />
<Compile Include="UI\TruthTable\ConstraintReduceView.fs" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
module Extractor
module CanvasExtractor

open CommonTypes
open Fable.Core
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/Simulator/FastSim/FastExtract.fs
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ let extractViewers (simulationData: SimulationData) : ((string * string) * int *
getFLabel fs fid, width, extractFastSimulationOutput fs simulationData.ClockTickNumber fid (OutputPortNumber 0))

let compareLoadedStates (fs: FastSimulation) (canv: CanvasState) (p: Project option) =
List.forall (fun ldc -> Extractor.loadedComponentIsSameAsProject canv ldc p) fs.SimulatedCanvasState
List.forall (fun ldc -> CanvasExtractor.loadedComponentIsSameAsProject canv ldc p) fs.SimulatedCanvasState

/// Get the input value of a fast component as a bigint.
/// fc: the fast component to get the input from.
Expand Down
8 changes: 4 additions & 4 deletions src/Renderer/Simulator/Simulator.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open SynchronousUtils
open GraphBuilder
open GraphMerger
open SimulationGraphAnalyser
open Extractor
open CanvasExtractor

// Building a SimulationGraph has four phases (not precisely in order of execution):
// 1. Building a simulation graph made of SimulationComponents.
Expand Down Expand Up @@ -63,7 +63,7 @@ let rec sheetsNeeded (ldcs: LoadedComponent list) (sheet: string) : string list
/// diagramName: name of current open sheet.
/// return updated list of all LDCs
let getUpdatedLoadedComponentState diagramName canvasState projLdcs =
let ldc' = Extractor.extractLoadedSimulatorComponent canvasState diagramName
let ldc' = CanvasExtractor.extractLoadedSimulatorComponent canvasState diagramName

let ldcs =
let ldcIsOpen ldc = ldc.Name = diagramName
Expand Down Expand Up @@ -97,8 +97,8 @@ let getCurrentSimulationState
List.tryFind (fun (ldc': LoadedComponent) -> ldc'.Name = ldc.Name) p.LoadedComponents
with
| _, None -> false
| false, Some ldc' -> Extractor.loadedComponentIsEqual ldc ldc'
| true, Some _ -> Extractor.stateIsEqual ldc.CanvasState canvState)
| false, Some ldc' -> CanvasExtractor.loadedComponentIsEqual ldc ldc'
| true, Some _ -> CanvasExtractor.stateIsEqual ldc.CanvasState canvState)

match simIsUpToDate, p.OpenFileName = fs.SimulatedTopSheet with
| false, _ -> SimOutOfDate
Expand Down
8 changes: 4 additions & 4 deletions src/Renderer/UI/CatalogueView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -58,8 +58,8 @@ let private makeCustom styles model dispatch (loadedComponent: LoadedComponent)
menuItem styles loadedComponent.Name (fun _ ->
let custom = Custom {
Name = loadedComponent.Name
InputLabels = Extractor.getOrderedCompLabels (Input1 (0, None)) canvas
OutputLabels = Extractor.getOrderedCompLabels (Output 0) canvas
InputLabels = CanvasExtractor.getOrderedCompLabels (Input1 (0, None)) canvas
OutputLabels = CanvasExtractor.getOrderedCompLabels (Output 0) canvas
Form = loadedComponent.Form
Description = loadedComponent.Description
}
Expand Down Expand Up @@ -87,8 +87,8 @@ let private makeVerilog styles model dispatch (loadedComponent: LoadedComponent)
menuItem styles loadedComponent.Name (fun _ ->
let verilog = Custom {
Name = loadedComponent.Name
InputLabels = Extractor.getOrderedCompLabels (Input1 (0, None)) canvas
OutputLabels = Extractor.getOrderedCompLabels (Output 0) canvas
InputLabels = CanvasExtractor.getOrderedCompLabels (Input1 (0, None)) canvas
OutputLabels = CanvasExtractor.getOrderedCompLabels (Output 0) canvas
Form = loadedComponent.Form
Description = loadedComponent.Description
}
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/UI/CustomCompPorts.fs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ open ModelType
open ModelHelpers
open CommonTypes
open FilesIO
open Extractor
open CanvasExtractor
open PopupHelpers
open MenuHelpers

Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/UI/MainView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ let viewSimSubTab canvasState model dispatch =
| StepSim ->
div [ Style [Width "90%"; MarginLeft "5%"; MarginTop "15px" ] ] [
Heading.h4 [] [ str "Step Simulation" ]
SimulationView.viewSimulation canvasState model dispatch
StepSimulationTop.viewSimulation canvasState model dispatch
]
| TruthTable ->
div [ Style [Width "90%"; MarginLeft "5%"; MarginTop "15px" ] ] [
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/UI/MenuHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ open ModelType
open ModelHelpers
open CommonTypes
open FilesIO
open Extractor
open CanvasExtractor
open Notifications
open PopupHelpers
open DrawModelType
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/UI/MiscMenuView.fs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ open CommonTypes
open ModelType
open ModelHelpers
open MenuHelpers
open Extractor
open CanvasExtractor
open FilesIO
open PopupHelpers
open DrawModelType
Expand Down
Loading

0 comments on commit 5c49155

Please sign in to comment.