Skip to content

Commit

Permalink
open ghw and fst after simulation complete
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Jul 15, 2024
1 parent 8865721 commit b86932e
Showing 1 changed file with 16 additions and 9 deletions.
25 changes: 16 additions & 9 deletions src/OneWare.Ghdl/Services/GhdlService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -247,18 +247,20 @@ public async Task<bool> SimulateFileAsync(IProjectFile file)
var elaborateResult = await ElaborateAsync(file, settings);
if (!elaborateResult) return false;

var waveFormFile = file.Root.SearchRelativePath(waveFilePath) as IFile;

if (waveFormFile == null)
{
waveFormFile = _projectExplorerService.GetTemporaryFile(Path.Combine(file.Root.RootFolderPath, waveFilePath));
}

//Open VCD inside IDE and prepare to stream
if (waveOutput == "VCD")
{
var openFile = file.Root.SearchRelativePath(waveFilePath) as IFile;

if (openFile == null)
{
openFile = _projectExplorerService.GetTemporaryFile(Path.Combine(file.Root.RootFolderPath, waveFilePath));
}

if (!File.Exists(openFile.FullPath)) await File.Create(openFile.FullPath).DisposeAsync();
if (!File.Exists(waveFormFile.FullPath)) await File.Create(waveFormFile.FullPath).DisposeAsync();

var doc = await _dockService.OpenFileAsync(openFile);
var doc = await _dockService.OpenFileAsync(waveFormFile);

// ReSharper disable once SuspiciousTypeConversion.Global
if (doc is IStreamableDocument vcd)
{
Expand All @@ -275,6 +277,11 @@ public async Task<bool> SimulateFileAsync(IProjectFile file)
var run = await ExecuteGhdlAsync(ghdlRunArguments, workingDirectory,
"Running GHDL Simulation...", AppState.Loading, true);

if (run.success && waveOutput is "GHW" or "FST")
{
_ = await _dockService.OpenFileAsync(waveFormFile);
}

return run.success;
}
}

0 comments on commit b86932e

Please sign in to comment.