Skip to content

Commit

Permalink
Read Quartus state from data base
Browse files Browse the repository at this point in the history
  • Loading branch information
qarlosalberto committed Nov 26, 2023
1 parent 8c1e839 commit dda1941
Show file tree
Hide file tree
Showing 21 changed files with 425 additions and 242 deletions.
4 changes: 3 additions & 1 deletion packages/colibri/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,9 @@
"tiny-glob": "^0.2.9",
"wavedrom": "3.3.0",
"web-tree-sitter": "^0.20.7",
"pyodide": "0.24.1"
"pyodide": "0.24.1",
"sqlite3": "^5.0.2",
"@types/sqlite3": "^3.1.11"
},
"devDependencies": {
"@babel/preset-typescript": "^7.21.0",
Expand Down
10 changes: 5 additions & 5 deletions packages/colibri/src/project_manager/multi_project_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export class Multi_project_manager {
////////////////////////////////////////////////////////////////////////////
// Load / Save in a file
////////////////////////////////////////////////////////////////////////////
public async load(emitter: events.EventEmitter): Promise<void> {
public async load(emitterProject: events.EventEmitter): Promise<void> {
let failed = false;

// Initialize
Expand All @@ -112,11 +112,13 @@ export class Multi_project_manager {
try {
if (prj_info.project_type === e_project_type.QUARTUS) {
this.add_project(
await QuartusProjectManager.fromJson(this.get_config_global_config(), prj_info, emitter)
await QuartusProjectManager.fromJson(this.get_config_global_config(), prj_info,
emitterProject)
);
} else {
this.add_project(
await Project_manager.fromJson(this.get_config_global_config(), prj_info, emitter)
await Project_manager.fromJson(this.get_config_global_config(),
prj_info, emitterProject)
);
}
} catch (error) {
Expand All @@ -132,7 +134,6 @@ export class Multi_project_manager {
failed = true;
}
}

}

catch (error) {
Expand All @@ -142,7 +143,6 @@ export class Multi_project_manager {
if (failed) {
throw new ProjectOperationError(`There have been errors loading project list from disk.`);
}

}

public save(): void {
Expand Down
39 changes: 21 additions & 18 deletions packages/colibri/src/project_manager/project_manager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@ import * as manager_toplevel_path from "./list_manager/toplevel_path";
import * as manager_dependency from "./dependency/dependency";
import { Tool_manager } from "./tool/tools_manager";
import {
t_test_declaration, t_test_result, e_clean_step, e_taskType, e_taskState, t_test_artifact,
e_reportType
t_test_declaration, t_test_result, e_clean_step, e_taskType, t_test_artifact,
e_reportType,
e_taskState
} from "./tool/common";
import { t_project_definition } from "./project_definition";
import * as file_utils from "../utils/file_utils";
Expand Down Expand Up @@ -73,22 +74,22 @@ export class Project_manager {
/** Config manager. */
private config_manager = new Config_manager();
private tools_manager = new Tool_manager(undefined);
private emitter: events.EventEmitter | undefined = undefined;
private emitterProject: events.EventEmitter;
/** Linter */
private linter = new Linter();
public taskStateManager: TaskStateManager = new TaskStateManager([]);

constructor(name: string, emitter: events.EventEmitter | undefined = undefined) {
constructor(name: string, emitterProject: events.EventEmitter) {
this.name = name;
this.emitter = emitter;
this.emitterProject = emitterProject;
// eslint-disable-next-line @typescript-eslint/no-this-alias
const selfm = this;
this.watchers = new manager_watcher.Watcher_manager((function () {
selfm.files.clear_automatic_files();
selfm.watchers.get().forEach(async (watcher: any) => {
if (file_utils.check_if_path_exist(watcher.path)) {
if (selfm.emitter !== undefined) {
selfm.emitter.emit('loading');
if (selfm.emitterProject !== undefined) {
selfm.emitterProject.emit('loading');
}
if (watcher.watcher_type === e_watcher_type.CSV) {
selfm.add_file_from_csv(watcher.path, false);
Expand All @@ -99,13 +100,13 @@ export class Project_manager {
else if (watcher.watcher_type === e_watcher_type.VIVADO) {
await selfm.add_file_from_vivado(selfm.config_manager.get_config(), watcher.path, false);
}
if (selfm.emitter !== undefined) {
selfm.emitter.emit('loaded');
selfm.emitter.emit('refresh');
if (selfm.emitterProject !== undefined) {
selfm.emitterProject.emit('loaded');
selfm.emitterProject.emit('refresh');
}
}
});
}), emitter);
}), emitterProject);
}

set projectDiskPath(projectDiskPath: string) {
Expand Down Expand Up @@ -143,9 +144,7 @@ export class Project_manager {
}

protected async notifyChanged(): Promise<void> {
if (this.emitter !== undefined) {
this.emitter.emit('refresh');
}
this.emitterProject.emit('refresh');
}

// eslint-disable-next-line @typescript-eslint/no-empty-function
Expand All @@ -155,9 +154,9 @@ export class Project_manager {
////////////////////////////////////////////////////////////////////////////
// Project
////////////////////////////////////////////////////////////////////////////
static async fromJson(_config: e_config, jsonContent: any, emitter: events.EventEmitter):
Promise<Project_manager> {
const prj = new Project_manager(jsonContent.name, emitter);
static async fromJson(_config: e_config, jsonContent: any, emitterProject: events.EventEmitter)
: Promise<Project_manager> {
const prj = new Project_manager(jsonContent.name, emitterProject);
// Files
jsonContent.files.forEach((file: any) => {
prj.add_file({
Expand Down Expand Up @@ -520,7 +519,7 @@ export class Project_manager {
return {} as ChildProcess;
}

public getTaskState(nameTask: e_taskType): e_taskState | null {
public getTaskState(nameTask: e_taskType): e_taskState | undefined {
return this.taskStateManager.getTaskState(nameTask);
}

Expand All @@ -538,4 +537,8 @@ export class Project_manager {
(result: p_result) => void): ChildProcess {
return {} as ChildProcess;
}

protected emitUpdateStatus() {
this.emitterProject.emit('updateStatus');
}
}
7 changes: 5 additions & 2 deletions packages/colibri/src/project_manager/tool/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,8 +194,11 @@ export type t_taskRep = {
"reports"?: e_reportType[],
"children"?: t_taskRep[],
"icon"?: e_iconType,
"duration"?: number | undefined,
"state": e_taskState,

"status"?: e_taskState | undefined,
"success"?: boolean | undefined,
"elapsed_time"?: number | undefined,
"percent"?: number | undefined,
}

////////////////////////////////////////////////////////////////////////////////
Expand Down
74 changes: 49 additions & 25 deletions packages/colibri/src/project_manager/tool/quartus/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,36 @@ export function getDefaultTaskList(): t_taskRep[] {
"name": e_taskType.QUARTUS_COMPILEDESIGN,
"label": "Run during full compilation",
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"state": e_taskState.IDLE,
"status": e_taskState.IDLE,
"children": [
{
"name": e_taskType.QUARTUS_IPGENERATION,
"label": "Run during full compilation",
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"state": e_taskState.IDLE,
"duration": undefined,
"status": e_taskState.IDLE,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
},
{
"name": e_taskType.QUARTUS_ANALYSISSYNTHESIS,
"label": "Run during full compilation",
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [e_reportType.REPORT,],
"duration": undefined,
"state": e_taskState.IDLE,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"status": e_taskState.IDLE,
"children": [
{
"name": e_taskType.QUARTUS_ANALYSISELABORATION,
"label": "Run during full compilation",
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [e_reportType.REPORT,],
"duration": undefined,
"state": e_taskState.IDLE
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"status": e_taskState.IDLE
},
{
"name": e_taskType.QUARTUS_SYNTHESIS,
Expand All @@ -39,8 +45,10 @@ export function getDefaultTaskList(): t_taskRep[] {
e_reportType.REPORT, e_reportType.TIMINGANALYZER,
e_reportType.TECHNOLOGYMAPVIEWER,
],
"state": e_taskState.IDLE,
"duration": undefined,
"status": e_taskState.IDLE,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
},
]
},
Expand All @@ -50,77 +58,93 @@ export function getDefaultTaskList(): t_taskRep[] {
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [e_reportType.REPORT, e_reportType.TIMINGANALYZER,],
"icon": e_iconType.TIME,
"duration": undefined,
"state": e_taskState.IDLE
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"status": e_taskState.IDLE
},
{
"name": e_taskType.QUARTUS_FITTER,
"label": "Run during full compilation",
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [e_reportType.REPORT,],
"duration": undefined,
"state": e_taskState.IDLE,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"status": e_taskState.IDLE,
"children": [
{
"name": e_taskType.QUARTUS_FITTERIMPLEMENT,
"label": "Run during full compilation",
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"state": e_taskState.IDLE,
"duration": undefined,
"status": e_taskState.IDLE,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"children": [
{
"name": e_taskType.QUARTUS_PLAN,
"label": "Run during full compilation",
"duration": undefined,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [
e_reportType.REPORT, e_reportType.TIMINGANALYZER,
e_reportType.TECHNOLOGYMAPVIEWER
],
"state": e_taskState.IDLE
"status": e_taskState.IDLE
},
{
"name": e_taskType.QUARTUS_PLACE,
"label": "Run during full compilation",
"duration": undefined,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [
e_reportType.REPORT, e_reportType.TIMINGANALYZER,
e_reportType.TECHNOLOGYMAPVIEWER
],
"state": e_taskState.IDLE,
"status": e_taskState.IDLE,
},
{
"name": e_taskType.QUARTUS_ROUTE,
"label": "Run during full compilation",
"duration": undefined,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [
e_reportType.REPORT, e_reportType.TIMINGANALYZER,
e_reportType.TECHNOLOGYMAPVIEWER
],
"state": e_taskState.IDLE,
"status": e_taskState.IDLE,
},
]
},
{
"name": e_taskType.QUARTUS_FITTERFINALIZE,
"label": "Run during full compilation",
"duration": undefined,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [e_reportType.REPORT, e_reportType.TIMINGANALYZER,],
"state": e_taskState.IDLE,
"status": e_taskState.IDLE,
},
]
},
{
"name": e_taskType.QUARTUS_TIMING,
"label": "Run during full compilation",
"duration": undefined,
"success": undefined,
"elapsed_time": undefined,
"percent": undefined,
"executionType": e_taskExecutionType.COMPLEXCOMMAND,
"reports": [e_reportType.REPORT, e_reportType.TIMINGANALYZER,],
"icon": e_iconType.TIME,
"state": e_taskState.IDLE,
"status": e_taskState.IDLE,
},
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import { e_config } from '../../../config/config_declaration';
import { QuartusProjectManager } from './quartusProjectManager';
import { get_toplevel_from_path } from '../../../utils/hdl_utils';
import events = require("events");

import * as path_lib from 'path';
import { createProject, getProjectInfo, getFilesFromProject, QuartusExecutionError } from './utils';
Expand All @@ -17,12 +18,13 @@ import { createProject, getProjectInfo, getFilesFromProject, QuartusExecutionErr
* @returns Quartus project.
**/
export async function createNewProject(config: e_config, name: string, family: string, part: string,
projectDirectory: string): Promise<QuartusProjectManager | undefined> {
projectDirectory: string, emitterProject: events.EventEmitter)
: Promise<QuartusProjectManager | undefined> {

try {
await createProject(config, name, family, part, projectDirectory);
const projectPath = path_lib.join(projectDirectory, `${name}`);
const project = new QuartusProjectManager(name, projectPath);
const project = new QuartusProjectManager(name, projectPath, name, emitterProject);
return project;
}
catch (error) {
Expand All @@ -36,12 +38,14 @@ export async function createNewProject(config: e_config, name: string, family: s
* @param project_path Quartus project path.
* @returns Quartus project.
**/
export async function loadProject(config: e_config, project_path: string): Promise<QuartusProjectManager> {
export async function loadProject(config: e_config, project_path: string,
emitterProject: events.EventEmitter): Promise<QuartusProjectManager> {
try {
const projectInfo = await getProjectInfo(config, project_path);
const projectFiles = await getFilesFromProject(config, project_path, true);

const quartusProject = new QuartusProjectManager(projectInfo.name, project_path);
const quartusProject = new QuartusProjectManager(projectInfo.name, project_path, projectInfo.currentRevision,
emitterProject);

// Search for toplevel path for top level entity
if (projectInfo.topEntity === "") {
Expand Down
Loading

0 comments on commit dda1941

Please sign in to comment.