Skip to content

Commit

Permalink
IceBreaker Test Fpga
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Nov 10, 2023
1 parent 885d92a commit 4444610
Show file tree
Hide file tree
Showing 16 changed files with 165 additions and 44 deletions.
10 changes: 10 additions & 0 deletions OneWare.sln
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneWare.ApplicationCommands
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneWare.ImageViewer", "src\OneWare.ImageViewer\OneWare.ImageViewer.csproj", "{20969AC5-F5E0-439C-9217-6FAE0CA01F73}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "FpgaSupport", "FpgaSupport", "{52DDC84A-27F8-4AF0-93C4-903614BE613D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "OneWare.IceBreaker", "src\OneWare.IceBreaker\OneWare.IceBreaker.csproj", "{B970E17F-ED6D-4A50-9477-BF2809198416}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -258,6 +262,10 @@ Global
{20969AC5-F5E0-439C-9217-6FAE0CA01F73}.Debug|Any CPU.Build.0 = Debug|Any CPU
{20969AC5-F5E0-439C-9217-6FAE0CA01F73}.Release|Any CPU.ActiveCfg = Release|Any CPU
{20969AC5-F5E0-439C-9217-6FAE0CA01F73}.Release|Any CPU.Build.0 = Release|Any CPU
{B970E17F-ED6D-4A50-9477-BF2809198416}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{B970E17F-ED6D-4A50-9477-BF2809198416}.Debug|Any CPU.Build.0 = Debug|Any CPU
{B970E17F-ED6D-4A50-9477-BF2809198416}.Release|Any CPU.ActiveCfg = Release|Any CPU
{B970E17F-ED6D-4A50-9477-BF2809198416}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{F08B36E8-AB80-42CD-BD47-6B05E96DA390} = {0761690C-7DA0-4554-9F6B-211088412DCD}
Expand Down Expand Up @@ -294,5 +302,7 @@ Global
{D1794384-1BD7-43DA-9846-203350EC4F0F} = {09A7F503-8517-4D41-A396-C193931636A4}
{5E74C94A-212C-404D-9B04-A362A9AA23BF} = {0761690C-7DA0-4554-9F6B-211088412DCD}
{20969AC5-F5E0-439C-9217-6FAE0CA01F73} = {6FF7E7F6-DA3F-477E-AAD7-47E3655FA34D}
{52DDC84A-27F8-4AF0-93C4-903614BE613D} = {6FF7E7F6-DA3F-477E-AAD7-47E3655FA34D}
{B970E17F-ED6D-4A50-9477-BF2809198416} = {52DDC84A-27F8-4AF0-93C4-903614BE613D}
EndGlobalSection
EndGlobal
3 changes: 3 additions & 0 deletions demo/OneWare.Demo/DemoApp.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using OneWare.Core;
using OneWare.Core.Data;
using OneWare.Core.Services;
using OneWare.IceBreaker;
using OneWare.Json;
using OneWare.Settings;
using OneWare.Shared.Services;
Expand Down Expand Up @@ -62,5 +63,7 @@ protected override void ConfigureModuleCatalog(IModuleCatalog moduleCatalog)
moduleCatalog.AddModule<TomlModule>();
moduleCatalog.AddModule<VcdViewerModule>();
moduleCatalog.AddModule<UniversalFpgaProjectSystemModule>();

moduleCatalog.AddModule<IceBreakerModule>();
}
}
1 change: 1 addition & 0 deletions demo/OneWare.Demo/OneWare.Demo.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
<ItemGroup>
<ProjectReference Include="..\..\src\OneWare.Core\OneWare.Core.csproj" />
<ProjectReference Include="..\..\src\OneWare.Cpp\OneWare.Cpp.csproj" />
<ProjectReference Include="..\..\src\OneWare.IceBreaker\OneWare.IceBreaker.csproj" />
<ProjectReference Include="..\..\src\OneWare.Json\OneWare.Json.csproj" />
<ProjectReference Include="..\..\src\OneWare.Toml\OneWare.Toml.csproj" />
<ProjectReference Include="..\..\src\OneWare.UniversalFpgaProjectSystem\OneWare.UniversalFpgaProjectSystem.csproj" />
Expand Down
13 changes: 13 additions & 0 deletions src/OneWare.IceBreaker/IceBreakerFpga.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using Avalonia.Controls;
using OneWare.IceBreaker.Views;
using OneWare.UniversalFpgaProjectSystem.Models;

namespace OneWare.IceBreaker;

public class IceBreakerFpga : FpgaModel
{
public IceBreakerFpga() : base("IceBreaker V1_0E", new IceBreakerV1_0e())
{

}
}
19 changes: 19 additions & 0 deletions src/OneWare.IceBreaker/IceBreakerModule.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using OneWare.IceBreaker.Views;
using OneWare.UniversalFpgaProjectSystem.Services;
using Prism.Ioc;
using Prism.Modularity;

namespace OneWare.IceBreaker;

public class IceBreakerModule : IModule
{
public void RegisterTypes(IContainerRegistry containerRegistry)
{

}

public void OnInitialized(IContainerProvider containerProvider)
{
containerProvider.Resolve<FpgaService>().AddFpga(new IceBreakerFpga());
}
}
15 changes: 15 additions & 0 deletions src/OneWare.IceBreaker/OneWare.IceBreaker.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
<Project Sdk="Microsoft.NET.Sdk">
<Import Project="..\..\build\props\Base.props" />
<Import Project="..\..\build\props\OneWare.Module.props" />

<ItemGroup>
<ProjectReference Include="..\OneWare.UniversalFpgaProjectSystem\OneWare.UniversalFpgaProjectSystem.csproj" />
</ItemGroup>

<ItemGroup>
<Compile Update="Views\IceBreakerV1_0e.axaml.cs">
<DependentUpon>IceBreakerV1_0e.axaml</DependentUpon>
<SubType>Code</SubType>
</Compile>
</ItemGroup>
</Project>
Original file line number Diff line number Diff line change
Expand Up @@ -2,29 +2,25 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:models="clr-namespace:OneWare.UniversalFpgaProjectSystem.Models"
xmlns:models="clr-namespace:OneWare.UniversalFpgaProjectSystem.Models;assembly=OneWare.UniversalFpgaProjectSystem"
mc:Ignorable="d"
d:DesignHeight="500"
d:DesignWidth="1000"
x:Class="OneWare.UniversalFpgaProjectSystem.Views.IceBreakerV1_0e" x:DataType="models:FpgaModel"
x:Class="OneWare.IceBreaker.Views.IceBreakerV1_0e" x:DataType="models:FpgaModel"
x:CompileBindings="True">


<UserControl.Styles>
<StyleInclude Source="avares://VHDPlus/Styles/Components.axaml" />
<StyleInclude Source="avares://OneWare.UniversalFpgaProjectSystem/Styles/Components.axaml" />
</UserControl.Styles>

<Design.DataContext>
<models:FpgaModel />
</Design.DataContext>

<Grid HorizontalAlignment="Center" RowDefinitions="Auto,Auto" ColumnDefinitions="Auto, Auto, 20,Auto, Auto">
<Border Grid.Row="0" Grid.Column="1" Background="#1c1c1c" Height="30" Width="90" Margin="44 0 0 -5"
HorizontalAlignment="Left" VerticalAlignment="Bottom">
<Grid>
<Menu x:CompileBindings="False" Classes="CruviLSPMOD BindMenu" DragDrop.AllowDrop="True"
DataContext="{Binding CruviLsInterfaces[0]}" Margin="0,0,0,0" HorizontalAlignment="Left"
VerticalAlignment="Center">
<!--
<Menu x:CompileBindings="False" Classes="CruviLSPMOD BindMenu" DragDrop.AllowDrop="True"
DataContext="{Binding CruviLsInterfaces[0]}" Margin="0,0,0,0" HorizontalAlignment="Left"
VerticalAlignment="Center">
<MenuItem Padding="0" x:DataType="cruviExtensions:CruviLsModel" Cursor="Hand"
Items="{Binding InterfaceMenu}" VerticalAlignment="Bottom">
<MenuItem.Header>
Expand All @@ -36,15 +32,17 @@
</MenuItem.Header>
</MenuItem>
</Menu>
-->
</Grid>
</Border>

<Border Grid.Row="0" Grid.Column="1" Background="#1c1c1c" Height="30" Width="90" Margin="0 0 46 -5"
HorizontalAlignment="Right" VerticalAlignment="Bottom">
<Grid>
<Menu x:CompileBindings="False" Classes="CruviLSPMOD BindMenu" DragDrop.AllowDrop="True"
DataContext="{Binding CruviLsInterfaces[1]}" Margin="0,0,0,0" HorizontalAlignment="Left"
VerticalAlignment="Center">
<!--
<Menu x:CompileBindings="False" Classes="CruviLSPMOD BindMenu" DragDrop.AllowDrop="True"
DataContext="{Binding CruviLsInterfaces[1]}" Margin="0,0,0,0" HorizontalAlignment="Left"
VerticalAlignment="Center">
<MenuItem Padding="0" x:DataType="cruviExtensions:CruviLsModel" Cursor="Hand"
Items="{Binding InterfaceMenu}" VerticalAlignment="Bottom">
<MenuItem.Header>
Expand All @@ -56,6 +54,7 @@
</MenuItem.Header>
</MenuItem>
</Menu>
-->
</Grid>
</Border>

Expand Down Expand Up @@ -377,6 +376,7 @@
<TextBlock VerticalAlignment="Center" Text="Button 3" Margin="5 70 0 0"></TextBlock>
</Grid>

<!--
<Border Grid.Row="0" Grid.Column="1"
IsVisible="{Binding CruviLsInterfaces[0].Extension, Converter={StaticResource ObjectNotNullConverter}}"
Width="150" Height="105" BoxShadow="0 0 5 5 #77000000" VerticalAlignment="Top"
Expand All @@ -400,6 +400,7 @@
DataContext="{Binding CruviLsInterfaces[1].Extension}"
Content="{Binding}" />
</Border>
-->
</Grid>

</UserControl>
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;
using Avalonia.Controls;

namespace OneWare.UniversalFpgaProjectSystem.Views;
namespace OneWare.IceBreaker.Views;

public partial class IceBreakerV1_0e : UserControl
{
Expand Down
36 changes: 24 additions & 12 deletions src/OneWare.UniversalFpgaProjectSystem/Models/FpgaModel.cs
Original file line number Diff line number Diff line change
@@ -1,27 +1,39 @@
using CommunityToolkit.Mvvm.ComponentModel;
using Avalonia.Controls;
using CommunityToolkit.Mvvm.ComponentModel;

namespace OneWare.UniversalFpgaProjectSystem.Models;

public class FpgaModel : ObservableObject
{
public string Name { get; }

public Dictionary<string, FpgaPin> AvailablePins { get; } = new();

private CompileConnectionModel _selectedConnection;
public Dictionary<string, FpgaPinModel> AvailablePins { get; } = new();

private FpgaPin _selectedPin;
public FpgaPin SelectedPin
private FpgaPinModel? _selectedPinModel;
public FpgaPinModel? SelectedPinModel
{
get => _selectedPin;
set => this.SetProperty(ref _selectedPin, value);
get => _selectedPinModel;
set => SetProperty(ref _selectedPinModel, value);
}

private CompileSignalModel _selectedSignal;
private NodeModel? _selectedNode;
public NodeModel? SelectedNode
{
get => _selectedNode;
set => SetProperty(ref _selectedNode, value);
}

public Control? UserInterface { get; }

public string Name { get; }

public FpgaModel(string name)
public FpgaModel(string name, Control? userInterface = null)
{
Name = name;
UserInterface = userInterface;
}

public void SelectPin(FpgaPinModel model)
{
SelectedPinModel = model;
}

public override string ToString()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

namespace OneWare.UniversalFpgaProjectSystem.Models;

public class FpgaPin : ObservableObject
public class FpgaPinModel : ObservableObject
{
public FpgaModel Parent { get; }
public string Name { get; }
Expand All @@ -21,8 +21,8 @@ public string ToolTipText
set => SetProperty(ref _toolTipText, value);
}

private CompileSignalModel _connection;
public CompileSignalModel Connection
private NodeModel? _connection;
public NodeModel? Connection
{
get => _connection;
set
Expand All @@ -33,11 +33,10 @@ public CompileSignalModel Connection
}
}

public CompilePinModel(string name, string description, FpgaModel parent)
public FpgaPinModel(string name, string description, FpgaModel parent)
{
Name = name;
Description = description;
Connection = null;
Parent = parent;
}
}
16 changes: 16 additions & 0 deletions src/OneWare.UniversalFpgaProjectSystem/Models/NodeModel.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
namespace OneWare.UniversalFpgaProjectSystem.Models;

public class NodeModel
{
public string Name { get; }

public NodeModel(string name)
{
Name = name;
}

public override string ToString()
{
return Name;
}
}
14 changes: 14 additions & 0 deletions src/OneWare.UniversalFpgaProjectSystem/Services/FpgaService.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using System.Collections.ObjectModel;
using OneWare.UniversalFpgaProjectSystem.Models;

namespace OneWare.UniversalFpgaProjectSystem.Services;

public class FpgaService
{
public ObservableCollection<FpgaModel> FpgaModels { get; } = new();

public void AddFpga(FpgaModel fpgaModel)
{
FpgaModels.Add(fpgaModel);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@
</Setter>
</Style>

<Style Selector="Button.Connectable" x:DataType="models:FpgaPin" x:CompileBindings="True">
<Style Selector="Button.Connectable" x:DataType="models:FpgaPinModel" x:CompileBindings="True">
<Setter Property="Cursor" Value="Hand" />
<Setter Property="Template">
<Setter.Value>
Expand All @@ -114,7 +114,7 @@
<DataTriggerBehavior ComparisonCondition="Equal" Value="True">
<DataTriggerBehavior.Binding>
<MultiBinding Converter="{x:Static converters:SharedConverters.ObjectsEqualConverter}">
<Binding Path="Parent.SelectedPin" />
<Binding Path="Parent.SelectedPinModel" />
<Binding Path="#PinBorder.DataContext"/>
</MultiBinding>
</DataTriggerBehavior.Binding>
Expand All @@ -128,7 +128,7 @@
<DataTriggerBehavior ComparisonCondition="Equal" Value="False">
<DataTriggerBehavior.Binding>
<MultiBinding Converter="{x:Static converters:SharedConverters.ObjectsEqualConverter}">
<Binding Path="Parent.SelectedPin" />
<Binding Path="Parent.SelectedPinModel" />
<Binding Path="#PinBorder.DataContext"/>
</MultiBinding>
</DataTriggerBehavior.Binding>
Expand All @@ -140,6 +140,7 @@
Value="{StaticResource NormalThickness}" />
</DataTriggerBehavior>

<!--
<DataTriggerBehavior ComparisonCondition="Equal" Value="True">
<DataTriggerBehavior.Binding>
<MultiBinding Converter="{x:Static converters:SharedConverters.ObjectsEqualConverter}">
Expand Down Expand Up @@ -168,6 +169,7 @@
PropertyName="BorderThickness"
Value="{StaticResource NormalThickness}" />
</DataTriggerBehavior>
-->
</Interaction.Behaviors>
</Grid>
</Border>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using OneWare.Shared.Models;
using OneWare.Shared.Services;
using OneWare.UniversalFpgaProjectSystem.Models;
using OneWare.UniversalFpgaProjectSystem.Services;
using OneWare.UniversalFpgaProjectSystem.ViewModels;
using OneWare.UniversalFpgaProjectSystem.Views;
using Prism.Ioc;
Expand All @@ -20,6 +21,7 @@ public class UniversalFpgaProjectSystemModule : IModule
public void RegisterTypes(IContainerRegistry containerRegistry)
{
containerRegistry.RegisterSingleton<UniversalFpgaProjectManager>();
containerRegistry.RegisterSingleton<FpgaService>();
}

public void OnInitialized(IContainerProvider containerProvider)
Expand Down
Loading

0 comments on commit 4444610

Please sign in to comment.