Skip to content

Commit

Permalink
Configuration App & Configurators (#56)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkorbel1 authored Dec 6, 2023
1 parent 75a989d commit 976b453
Show file tree
Hide file tree
Showing 66 changed files with 2,342 additions and 191 deletions.
60 changes: 59 additions & 1 deletion .github/workflows/general.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,62 @@ jobs:
with:
runCmd: tool/gh_actions/run_tests.sh

run-flutter-checks:
name: Run Flutter Checks
permissions: {}
timeout-minutes: 30
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.10.6

- name: Analyze flutter source
run: tool/gh_actions/analyze_flutter_source.sh

- name: Run flutter tests
run: tool/gh_actions/run_flutter_tests.sh

- name: Build static site
run: tool/gh_actions/hcl_site_generation_build.sh

deploy-site:
name: Deploy ROHD-HCL Generator site
needs: [run-checks, run-flutter-checks]
if: github.event_name == 'push'
permissions:
contents: write # required for "JamesIves/github-pages-deploy-action"
timeout-minutes: 30
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup Flutter SDK
uses: flutter-actions/setup-flutter@v2
with:
channel: stable
version: 3.10.6

- name: Build static site
run: tool/gh_actions/hcl_site_generation_build.sh

- name: Deploy the generated site to website branch
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: confapp/build/web
target-folder: confapp
branch: website

deploy-documentation:
name: Deploy Documentation
needs: run-checks
Expand Down Expand Up @@ -102,4 +158,6 @@ jobs:
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: doc/api
branch: docs
branch: website


2 changes: 2 additions & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ analyzer:
strict-casts: true
strict-inference: true
strict-raw-types: true
exclude:
- confapp/**

# keep up to date, matching https://dart-lang.github.io/linter/lints/options/options.html
# some lints are not yet available, so disabled and marked with [not currently recognized]
Expand Down
50 changes: 50 additions & 0 deletions confapp/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
# Miscellaneous
*.class
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/
migrate_working_dir/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# The .vscode folder contains launch configuration and tasks you configure in
# VS Code which you may wish to be included in version control, so this line
# is commented out by default.
#.vscode/

# Flutter/Dart/Pub related
**/doc/api/
**/ios/Flutter/.last_build_id
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
/build/

# Symbolication related
app.*.symbols

# Obfuscation related
app.*.map.json

# Android Studio will place build artifacts here
/android/app/debug
/android/app/profile
/android/app/release

android
ios
linux
macos
windows
45 changes: 45 additions & 0 deletions confapp/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled.

version:
revision: 796c8ef79279f9c774545b3771238c3098dbefab
channel: stable

project_type: app

# Tracks metadata for the flutter migrate command
migration:
platforms:
- platform: root
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: android
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: ios
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: linux
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: macos
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: web
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab
- platform: windows
create_revision: 796c8ef79279f9c774545b3771238c3098dbefab
base_revision: 796c8ef79279f9c774545b3771238c3098dbefab

# User provided section

# List of Local paths (relative to this file) that should be
# ignored by the migrate tool.
#
# Files that are not part of the templates will be ignored by default.
unmanaged_files:
- 'lib/main.dart'
- 'ios/Runner.xcodeproj/project.pbxproj'
15 changes: 15 additions & 0 deletions confapp/.vscode/launch.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Flutter: Run all Tests",
"type": "dart",
"request": "launch",
"program": "./test/",
"args": ["--platform", "chrome"]
},
]
}
10 changes: 10 additions & 0 deletions confapp/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# ROHD-HCL Flutter Configuration App

This is a web app that allows RTL generation (SystemVerilog) based on the specific configuration.

## Widget Tree

```mermaid
flowchart TD;
HCLAPP:material_widget-->HCLPage:register_cubit-->HCLView-->MainPage --> ComponentSideBar:Nav & SVGenerator:Content
```
6 changes: 6 additions & 0 deletions confapp/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

include: package:flutter_lints/flutter.yaml

linter:
rules:

19 changes: 19 additions & 0 deletions confapp/lib/app.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// app.dart
// Main app
//
// 2023 December

import 'package:flutter/material.dart';
import 'package:confapp/hcl/hcl.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

class HCLApp extends MaterialApp {
HCLApp({super.key, required List<Configurator> components})
: super(
home: HCLPage(
components: components,
));
}
26 changes: 26 additions & 0 deletions confapp/lib/hcl/cubit/component_cubit.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// component_cubit.dart
// Implementation of a cubit for Configurators
//
// 2023 December

import 'package:bloc/bloc.dart';
import 'package:rohd_hcl/rohd_hcl.dart';

/// Controls the selected component.
class ComponentCubit extends Cubit<Configurator> {
Configurator selectedComponent;

final List<Configurator> components;

ComponentCubit(this.components)
: selectedComponent = components.first,
super(components.first);

void setSelectedComponent(Configurator selectedComponent) {
this.selectedComponent = selectedComponent;
emit(selectedComponent);
}
}
56 changes: 56 additions & 0 deletions confapp/lib/hcl/cubit/system_verilog_cubit.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// system_verilog_cubit.dart
// Implementation of a cubit for generating verilog
//
// 2023 December

import 'package:bloc/bloc.dart';

enum GenerationState { initial, loading, done }

class SystemVerilogCubitState {
final String systemVerilog;
final GenerationState generationState;
final String name;

const SystemVerilogCubitState(
{required this.systemVerilog,
required this.generationState,
required this.name});
const SystemVerilogCubitState.loading()
: this(
systemVerilog: 'Loading...',
generationState: GenerationState.loading,
name: 'loading');
const SystemVerilogCubitState.done(String systemVerilog, String name)
: this(
systemVerilog: systemVerilog,
generationState: GenerationState.done,
name: name);
const SystemVerilogCubitState.initial()
: this(
systemVerilog: 'Click "Generate RTL"!',
generationState: GenerationState.initial,
name: 'init');
}

/// Controls the generated SystemVerilog to display
class SystemVerilogCubit extends Cubit<SystemVerilogCubitState> {
SystemVerilogCubit() : super(const SystemVerilogCubitState.loading()) {
initializeData();
}

void initializeData() async {
emit(const SystemVerilogCubitState.initial());
}

void setLoading() {
emit(const SystemVerilogCubitState.loading());
}

void setRTL(String rtl, String name) {
emit(SystemVerilogCubitState.done(rtl, name));
}
}
4 changes: 4 additions & 0 deletions confapp/lib/hcl/hcl.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause

export 'view/hcl_page.dart';
37 changes: 37 additions & 0 deletions confapp/lib/hcl/view/hcl_page.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Copyright (C) 2023 Intel Corporation
// SPDX-License-Identifier: BSD-3-Clause
//
// hcl_page.dart
// Main page for the app
//
// 2023 December

import 'package:confapp/hcl/cubit/system_verilog_cubit.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:confapp/hcl/cubit/component_cubit.dart';
import 'package:rohd_hcl/rohd_hcl.dart';
import 'hcl_view.dart';

class HCLPage extends StatelessWidget {
final List<Configurator> components;

/// {@macro counter_page}
const HCLPage({super.key, required this.components});

@override
Widget build(BuildContext context) {
return MultiBlocProvider(
providers: [
BlocProvider(
// Look pretty ungly using static, not sure how to improve this
create: (BuildContext context) => ComponentCubit(components),
),
BlocProvider(
create: (BuildContext context) => SystemVerilogCubit(),
),
],
child: const HCLView(),
);
}
}
Loading

0 comments on commit 976b453

Please sign in to comment.