Skip to content

Commit

Permalink
fix: miscellaneous
Browse files Browse the repository at this point in the history
fix DOM warning from text use dout of svg
Possible fix of NaN rect width caused by shownCycles=0.
Polish - debug printing
  • Loading branch information
tomcl committed Aug 15, 2024
1 parent f2eb097 commit 747fa42
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 21 deletions.
2 changes: 1 addition & 1 deletion src/Renderer/UI/UpdateHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ let getMenuView (act: MenuCommand) (model: Model) (dispatch: Msg -> Unit) =
| MenuNewFile ->
TopMenuView.addFileToProject model dispatch
| MenuLostFocus ->
printf "Lost focus!"
()

| MenuExit ->
FileUpdate.doActionWithSaveFileDialog "Exit ISSIE" CloseApp model dispatch ()
Expand Down
10 changes: 2 additions & 8 deletions src/Renderer/UI/WaveSim/WaveSim.fs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ let rec refreshWaveSim (newSimulation: bool) (wsModel: WaveSimModel) (model: Mod
else
// starting runSimulation
//printfn "Starting refresh"
let lastCycleNeeded = (wsModel.StartCycle + wsModel.ShownCycles)*wsModel.CycleMultiplier + 1
let lastCycleNeeded = (wsModel.StartCycle + wsModel.ShownCycles - 1)*wsModel.CycleMultiplier + 1

FastRun.runFastSimulation (Some Constants.initSimulationTime) lastCycleNeeded fs
|> (fun speedOpt ->
Expand All @@ -77,7 +77,6 @@ let rec refreshWaveSim (newSimulation: bool) (wsModel: WaveSimModel) (model: Mod
FastRun.runFastSimulation None lastCycleNeeded fs |> ignore
// simulation has finished so can generate waves

printfn $"Ending refresh now at Tick {fs.ClockTick}..."
let allWavesStart = TimeHelpers.getTimeMs ()
//printfn "starting getwaves"
// redo waves based on new simulation
Expand All @@ -97,17 +96,14 @@ let rec refreshWaveSim (newSimulation: bool) (wsModel: WaveSimModel) (model: Mod

match simulationIsUptodate with
| falae ->

printfn $"Simulationuptodate: {simulationIsUptodate}"
// need to use isSameWave here becasue sarray index may have changed
// need to use isSameWave here because array index may have changed
let wavesToBeMade =
allWaves
|> Map.filter (fun wi wave ->
// Only generate waveforms for selected waves.
// Regenerate waveforms whenever they have changed
let hasChanged = not <| WaveSimWaves.waveformIsUptodate wsModel wave
//if List.contains index ws.SelectedWaves then
printfn $"Checking redraw: {wave.CompLabel} hasChanged={hasChanged} uptodate={simulationIsUptodate}"
List.exists (fun wi' -> isSameWave wi wi') wsModel.SelectedWaves && hasChanged && simulationIsUptodate)
|> Map.toList
|> List.map fst
Expand Down Expand Up @@ -182,10 +178,8 @@ let refreshButtonAction canvasState model dispatch = fun _ ->
let wsSheet =
match model.WaveSimSheet with
| None ->
printfn "Sheet was none"
Option.get (getCurrFile model)
| Some sheet ->
printfn "sheet already existing"
sheet
printfn $"Refresh Button with width = {model.WaveSimViewerWidth}"
let model =
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/UI/WaveSim/WaveSimHelpers.fs
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ let calculateNonBinaryTransitions (waveValues: array<'a>) (startCycle: int) (sho
subSamp waveValues (startCyc) (endCyc-startCyc+1) multiplier
| _ ->
printfn $"Before failure: waveValues.Length {waveValues.Length} e*m: {(startCycle+shownCycles-1)*multiplier} "
failwithf "Shown cycles is beyond array bounds"
failwithf $"Shown cycles is beyond array bounds: start={startCycle} shown={shownCycles} mult={multiplier} length = {waveValues.Length}"
|> Array.pairwise
|> Array.map (fun (x, y) -> if x = y then Const else Change)
|> Array.append [| Change |]
Expand Down
14 changes: 6 additions & 8 deletions src/Renderer/UI/WaveSim/WaveSimNavigation.fs
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ let validateScrollBarInfo (wsm: WaveSimModel) =


let inline updateViewerWidthInWaveSim w (model:Model) =
printfn "updateviewerWidthInWaveSim" // ***>
let wsModel = getWSModel model
//dispatch <| SetViewerWidth w
let namesColWidth = calcNamesColWidth wsModel
Expand Down Expand Up @@ -128,7 +127,7 @@ let changeMultiplier newMultiplier (ws: WaveSimModel) =
let oldM = ws.CycleMultiplier
printfn $"Old: {oldM} shown {ws.ShownCycles} start={ws.StartCycle} NewM={newMultiplier}"
let sampsHalf = (float ws.ShownCycles - 1.) / 2.
let newShown = min ws.ShownCycles (Constants.maxLastClk / newMultiplier)
let newShown = 1 + min ws.ShownCycles (Constants.maxLastClk / newMultiplier)
let newStart = int ((float ws.StartCycle + sampsHalf) * float oldM / float newMultiplier - (float newShown - 1.) / 2.)
printfn $"New: shown={newShown} start = {newStart}"
{ws with ShownCycles = newShown; StartCycle = newStart; CycleMultiplier = newMultiplier}
Expand Down Expand Up @@ -266,7 +265,7 @@ let changeZoom (wsModel: WaveSimModel) (zoomIn: bool) (dispatch: Msg -> unit) =
else
sc)
// final limits check so no cycle is outside allowed range
|> min (Constants.maxLastClk / wsModel.CycleMultiplier - shownCycles)
|> min (Constants.maxLastClk / wsModel.CycleMultiplier - shownCycles + 1)
|> max 0


Expand Down Expand Up @@ -439,7 +438,7 @@ let multiplierMenuButton(wsModel: WaveSimModel) (dispatch: Msg -> unit) =
/// key = 0 .. n-1 where there are n possible multipliers
let mulTable = Constants.multipliers
let menuItem (key) =
let itemLegend = str (match key with | 0 -> "Every Cycle" | _ -> $"Every {mulTable[key]} cycles")
let itemLegend = str (match key with | 0 -> "Every Cycle (normal)" | _ -> $"Every {mulTable[key]} cycles")
Menu.Item.li
[ Menu.Item.IsActive (Constants.multipliers[key] = wsModel.CycleMultiplier)
Menu.Item.OnClick (fun _ ->
Expand All @@ -450,15 +449,14 @@ let multiplierMenuButton(wsModel: WaveSimModel) (dispatch: Msg -> unit) =
let menu =
div []
[
h5 [Style[Color IColor.IsDanger]] [str "Warning: extra zoom view greater than X1 will sample the waveform and so lose information about fast-changing outputs"]
p [Style[ Color IColor.IsDanger; FontWeight 600; FontSize "18px"]] [str "Warning: zoom greater than X1 will sample the waveform and lose information about fast-changing outputs"]
br []
h5 [] [str "It should only be used to observe slow-chnaging signals, when it is necessary to see large clock cycle range, \
and the normal - zoom function is not enough."]
p [] [str "Use it to observe slow-changing signals when the normal zoom range is not enough."]
br []
Menu.menu [] [ Menu.list [] (List.map menuItem [0 .. mulTable.Length - 1 ])]
]

let buttonClick = Button.OnClick (fun _ ->
printfn $"Mul={wsModel.CycleMultiplier}"
dispatch <| ShowStaticInfoPopup("Multiplier",menu,dispatch ))
dispatch <| ShowStaticInfoPopup("Extra Zoom Sampling Rate",menu,dispatch ))
Button.button ( buttonClick :: topHalfButtonProps IColor.IsDanger "ZoomButton" false) [str $"Extra zoom X{wsModel.CycleMultiplier}"]
5 changes: 3 additions & 2 deletions src/Renderer/UI/WaveSim/WaveSimWaveforms.fs
Original file line number Diff line number Diff line change
Expand Up @@ -219,7 +219,8 @@ let private valuesColumn wsModel : ReactElement =
let start = TimeHelpers.getTimeMs ()
let width, rows = valueRows wsModel
let cursorClkNum = wsModel.CurrClkCycleDetail
let topRowNumber = [ text [Style [FontWeight "bold"; PaddingLeft "2pt"]] [str (string <| cursorClkNum)] ]
let topRowNumber = [ div [Style [FontSize "10pt" ; VerticalAlign "bottom"; FontWeight "bold"; PaddingLeft "4pt"]] [str (string <| cursorClkNum)] ]
printfn "%A" topRowNumber

div [ HTMLAttr.Id "ValuesCol" ; valuesColumnStyle width]
(List.concat [ topRow topRowNumber ; rows ])
Expand Down Expand Up @@ -272,7 +273,7 @@ let showWaveforms (model: Model) (wsModel: WaveSimModel) (dispatch: Msg -> unit)
div [ HTMLAttr.Id "Scroller"; Style [ Height cssHeight; Width "100%"; CSSProp.Custom("overflow", "auto")]] [
div [ HTMLAttr.Id "WaveCols" ;showWaveformsStyle ]
[
namesColumn model wsModel dispatch
namesColumn model wsModel dispatch
waveformColumn wsModel dispatch
valuesColumn wsModel
]
Expand Down
2 changes: 1 addition & 1 deletion src/Renderer/VerilogComponent/TestParser.fs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ let errorInfoToJson (errorInfo: ErrorInfo) =
open FilesIO
open Fable.SimpleJson

printfn "[TEST] Starting Verilog parser tests"
//printfn "[TEST] Starting Verilog parser tests"


let parseFile src dst =
Expand Down

0 comments on commit 747fa42

Please sign in to comment.