Skip to content

Commit bdec9a9

Browse files
committed
Preparing for parser library
1 parent a20b2de commit bdec9a9

22 files changed

Lines changed: 1301 additions & 1318 deletions

Directory.Build.props

Lines changed: 0 additions & 46 deletions
This file was deleted.

Directory.Build.targets

Lines changed: 0 additions & 51 deletions
This file was deleted.
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using System;
2+
using SpiceSharp.Components;
3+
using SpiceSharpParser;
4+
using SpiceSharpParser.ModelReaders.Netlist.Spice.Readers.EntityGenerators.Components.Semiconductors;
5+
using SpiceSharpParser.ModelReaders.Netlist.Spice.Readers.EntityGenerators.Models;
6+
7+
namespace SpiceSharpBSIM.Parser;
8+
9+
/// <summary>
10+
/// A helper class that can extend Spice#.Parser with BSIM1 models.
11+
/// </summary>
12+
public static class BSIM1Extensions
13+
{
14+
/// <summary>
15+
/// Extends a <see cref="SpiceSharpReader"/> with the BSIM1 models.
16+
/// </summary>
17+
/// <param name="reader">The reader.</param>
18+
/// <param name="level">The level.</param>
19+
/// <exception cref="NotImplementedException"></exception>
20+
public static void UseBSIM1(this SpiceSharpReader reader, int level = 4)
21+
{
22+
// Register the model level
23+
var nmosModelGenerator = reader.Settings.Mappings.Models.GetValue("NMOS", false);
24+
var pmosModelGenerator = reader.Settings.Mappings.Models.GetValue("PMOS", false);
25+
if (ReferenceEquals(nmosModelGenerator, pmosModelGenerator) &&
26+
nmosModelGenerator is MosfetModelGenerator modelGenerator)
27+
modelGenerator.AddGenericLevel<BSIM1Model, Components.Semiconductors.BSIM.BSIM1Behaviors.ModelParameters>(level);
28+
else
29+
throw new NotImplementedException();
30+
31+
// Register the mosfet component
32+
if (reader.Settings.Mappings.Components.TryGetValue("M", false, out var generator) &&
33+
generator is MosfetGenerator mosGenerator)
34+
mosGenerator.AddMosfet<BSIM1Model, BSIM1>();
35+
else
36+
throw new NotImplementedException();
37+
}
38+
}
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>netstandard2.1</TargetFramework>
5+
<UseGitInfo>true</UseGitInfo>
6+
<GitTagRegex>parser-v*</GitTagRegex>
7+
<LangVersion>latest</LangVersion>
8+
</PropertyGroup>
9+
10+
<ItemGroup>
11+
<PackageReference Include="SpiceSharp-Parser" Version="3.2.8" />
12+
</ItemGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="GitInfo" Version="3.3.5">
16+
<PrivateAssets>all</PrivateAssets>
17+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
18+
</PackageReference>
19+
</ItemGroup>
20+
21+
<ItemGroup>
22+
<ProjectReference Include="..\SpiceSharpBSIM\SpiceSharpBSIM.csproj" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Update="SpiceSharp" Version="3.2.3" />
27+
</ItemGroup>
28+
29+
<ItemGroup>
30+
<PackageReference Update="SpiceSharpGenerator" Version="1.0.9">
31+
<PrivateAssets>all</PrivateAssets>
32+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
33+
</PackageReference>
34+
</ItemGroup>
35+
</Project>

SpiceSharpBSIM.sln

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,14 @@
11

22
Microsoft Visual Studio Solution File, Format Version 12.00
3-
# Visual Studio 15
4-
VisualStudioVersion = 15.0.27428.2005
3+
# Visual Studio Version 17
4+
VisualStudioVersion = 17.14.36811.4
55
MinimumVisualStudioVersion = 10.0.40219.1
66
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpiceSharpBSIM", "SpiceSharpBSIM\SpiceSharpBSIM.csproj", "{C0C54353-8BB5-40CE-9B50-C103451CFD95}"
77
EndProject
88
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpiceSharpBSIMTests", "SpiceSharpBSIMTests\SpiceSharpBSIMTests.csproj", "{973E74D9-9D52-432D-9400-8BAA78D99B5C}"
99
EndProject
10+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "SpiceSharpBSIM.Parser", "SpiceSharpBSIM.Parser\SpiceSharpBSIM.Parser.csproj", "{F177A875-BEB2-4EEF-86AC-768374681011}"
11+
EndProject
1012
Global
1113
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1214
Debug|Any CPU = Debug|Any CPU
@@ -21,6 +23,10 @@ Global
2123
{973E74D9-9D52-432D-9400-8BAA78D99B5C}.Debug|Any CPU.Build.0 = Debug|Any CPU
2224
{973E74D9-9D52-432D-9400-8BAA78D99B5C}.Release|Any CPU.ActiveCfg = Release|Any CPU
2325
{973E74D9-9D52-432D-9400-8BAA78D99B5C}.Release|Any CPU.Build.0 = Release|Any CPU
26+
{F177A875-BEB2-4EEF-86AC-768374681011}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
27+
{F177A875-BEB2-4EEF-86AC-768374681011}.Debug|Any CPU.Build.0 = Debug|Any CPU
28+
{F177A875-BEB2-4EEF-86AC-768374681011}.Release|Any CPU.ActiveCfg = Release|Any CPU
29+
{F177A875-BEB2-4EEF-86AC-768374681011}.Release|Any CPU.Build.0 = Release|Any CPU
2430
EndGlobalSection
2531
GlobalSection(SolutionProperties) = preSolution
2632
HideSolutionNode = FALSE
Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,33 @@
11
<Project Sdk="Microsoft.NET.Sdk">
22

33
<PropertyGroup>
4+
<TargetFramework>netstandard2.0</TargetFramework>
45
<Description>Spice#.BSIM is a library for Spice# that contains the BSIM models.</Description>
56
<UseGitInfo>true</UseGitInfo>
67
<GitTagRegex>v*</GitTagRegex>
8+
<LangVersion>latest</LangVersion>
79
</PropertyGroup>
810

911
<ItemGroup>
10-
<PackageReference Update="GitInfo" Version="3.6.0" />
12+
<PackageReference Include="SpiceSharp" />
13+
<PackageReference Include="SpiceSharpGenerator" />
14+
</ItemGroup>
15+
16+
<ItemGroup>
17+
<PackageReference Include="GitInfo" Version="3.3.5">
18+
<PrivateAssets>all</PrivateAssets>
19+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
20+
</PackageReference>
1121
</ItemGroup>
1222

1323
<ItemGroup>
1424
<PackageReference Update="SpiceSharp" Version="3.2.3" />
1525
</ItemGroup>
1626

1727
<ItemGroup>
18-
<PackageReference Update="SpiceSharpGenerator" Version="1.0.9" />
28+
<PackageReference Update="SpiceSharpGenerator" Version="1.0.9">
29+
<PrivateAssets>all</PrivateAssets>
30+
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
31+
</PackageReference>
1932
</ItemGroup>
2033
</Project>

0 commit comments

Comments
 (0)