-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ghdl vhdl to verilog pre compile step
- Loading branch information
1 parent
2598aba
commit ceef212
Showing
3 changed files
with
43 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using OneWare.Essentials.Helpers; | ||
using OneWare.Essentials.Services; | ||
using OneWare.Ghdl.Services; | ||
using OneWare.UniversalFpgaProjectSystem.Models; | ||
using OneWare.UniversalFpgaProjectSystem.Services; | ||
|
||
namespace OneWare.Ghdl; | ||
|
||
public class GhdlVhdlToVerilogPreCompileStep(GhdlService ghdlService, ILogger logger) : IFpgaPreCompileStep | ||
{ | ||
public string Name => "GHDL Vhdl to Verilog"; | ||
|
||
public async Task PerformPreCompileStepAsync(UniversalFpgaProjectRoot project, FpgaModel fpga) | ||
{ | ||
try | ||
{ | ||
var buildPath = Path.Combine(project.FullPath, "ghdl-output"); | ||
if(Directory.Exists(buildPath)) Directory.Delete(buildPath, true); | ||
Directory.CreateDirectory(buildPath); | ||
var buildDir = project.AddFolder("ghdl-output"); | ||
|
||
foreach (var vhdlFile in project.Files | ||
.Where(x => x.Extension is ".vhd" or ".vhdl") | ||
.Where(x => !project.CompileExcluded.Contains(x)) | ||
.Where(x => !project.TestBenches.Contains(x))) | ||
{ | ||
await ghdlService.SynthAsync(vhdlFile, "verilog", buildPath); | ||
} | ||
ProjectHelper.ImportEntries(buildPath, buildDir); | ||
} | ||
catch (Exception e) | ||
{ | ||
logger.Error(e.Message, e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters