Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/components/Extra.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Circuit Elements Panel -->
<ElementsPanel v-if="!simulatorMobileStore.showMobileView"/>
<ElementsPanel v-if="!simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog"/>
<!-- --------------------------------------------------------------------------------------------- -->

<!-- --------------------------------------------------------------------------------------------- -->
Expand All @@ -23,12 +23,12 @@

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Timing Diagram Panel -->
<TimingDiagramPanel v-if="!simulatorMobileStore.showMobileView" />
<TimingDiagramPanel v-if="!simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog" />
<!-- --------------------------------------------------------------------------------------------- -->

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Testbench -->
<TestBenchPanel v-if="!simulatorMobileStore.showMobileView" />
<TestBenchPanel v-show="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
<TestBenchCreator v-if="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
Expand All @@ -43,11 +43,9 @@

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Verilog Editor Panel -->
<VerilogEditorPanel v-if="!simulatorMobileStore.showMobileView" />
<VerilogEditorPanel v-show="!simulatorMobileStore.showMobileView || simulatorMobileStore.isVerilog" />


<div id="code-window" class="code-window">
<textarea id="codeTextArea"></textarea>
</div>
<VerilogEditorPanelMobile v-if="simulatorMobileStore.showMobileView && simulatorMobileStore.showVerilogPanel" />
<!-- --------------------------------------------------------------------------------------------- -->

Expand Down
136 changes: 69 additions & 67 deletions src/components/Panels/VerilogEditorPanel/VerilogEditorPanel.vue
Original file line number Diff line number Diff line change
@@ -1,82 +1,84 @@
<template>
<div id="code-window" class="code-window">
<textarea id="codeTextArea"></textarea>
</div>
<div
id="verilogEditorPanel"
class="noSelect defaultCursor draggable-panel draggable-panel-css"
>
<PanelHeader
:header-title="$t('simulator.panel_header.verilog_module')"
/>

<div class="panel-body">
<div class="layout-body">
<button
class="largeButton btn btn-xs custom-btn--tertiary"
@click="resetVerilogCode"
>
{{ $t('simulator.panel_body.verilog_module.reset_code') }}
</button>
<button
class="largeButton btn btn-xs custom-btn--primary"
@click="saveVerilogCode"
>
{{ $t('simulator.panel_body.verilog_module.save_code') }}
</button>
<button
class="largeButton btn btn-xs custom-btn--secondary"
@click="toggleTerminal"
>
<i class="fas fa-terminal"></i>
{{ verilogStore.isTerminalVisible ? 'Hide' : 'Show' }} Terminal
</button>
<div id="verilogOutput">
{{
$t(
'simulator.panel_body.verilog_module.module_in_experiment_notice'
)
}}
</div>
</div>
<div class="verilog-editor-container">
<div id="code-window" class="code-window">
<textarea id="codeTextArea"></textarea>
</div>

<div class="panel-header text-center">
{{ $t('simulator.panel_body.verilog_module.apply_themes') }}
</div>
<div class="panel-body">
<div class="layout-body">
<div>
<p class="text-center mb-2">
<div
id="verilogEditorPanel"
class="noSelect defaultCursor draggable-panel draggable-panel-css"
>
<PanelHeader
:header-title="$t('simulator.panel_header.verilog_module')"
/>

<div class="panel-body">
<div class="layout-body">
<button
class="largeButton btn btn-xs custom-btn--tertiary"
@click="resetVerilogCode"
>
{{ $t('simulator.panel_body.verilog_module.reset_code') }}
</button>
<button
class="largeButton btn btn-xs custom-btn--primary"
@click="saveVerilogCode"
>
{{ $t('simulator.panel_body.verilog_module.save_code') }}
</button>
<button
class="largeButton btn btn-xs custom-btn--secondary"
@click="toggleTerminal"
>
<i class="fas fa-terminal"></i>
{{ verilogStore.isTerminalVisible ? 'Hide' : 'Show' }} Terminal
</button>
<div id="verilogOutput">
{{
$t(
'simulator.panel_body.verilog_module.select_theme'
'simulator.panel_body.verilog_module.module_in_experiment_notice'
)
}}
</p>
<select
v-model="verilogStore.selectedTheme"
class="applyTheme"
@change="(e) => verilogStore.setTheme((e.target as HTMLSelectElement).value)"
>
<optgroup
v-for="optgroup in Themes"
:key="optgroup.label"
:label="optgroup.label"
</div>
</div>
</div>

<div class="panel-header text-center">
{{ $t('simulator.panel_body.verilog_module.apply_themes') }}
</div>
<div class="panel-body">
<div class="layout-body">
<div>
<p class="text-center mb-2">
{{
$t(
'simulator.panel_body.verilog_module.select_theme'
)
}}
</p>
<select
v-model="verilogStore.selectedTheme"
class="applyTheme"
@change="(e) => verilogStore.setTheme((e.target as HTMLSelectElement).value)"
>
<option
v-for="option in optgroup.options"
:key="option.value"
<optgroup
v-for="optgroup in Themes"
:key="optgroup.label"
:label="optgroup.label"
>
{{ option.value }}
</option>
</optgroup>
</select>
<option
v-for="option in optgroup.options"
:key="option.value"
>
{{ option.value }}
</option>
</optgroup>
</select>
</div>
</div>
</div>
</div>
<VerilogTerminal ref="verilogTerminal" />
</div>
<VerilogTerminal ref="verilogTerminal" />
</template>

<script lang="ts" setup>
Expand Down
20 changes: 18 additions & 2 deletions src/simulator/src/plotArea.js
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ const plotArea = {
},
// download as image
download() {
if(isTauri()){
if (isTauri()) {
this.downloadImageDesktop()
return
}
Expand Down Expand Up @@ -162,9 +162,17 @@ const plotArea = {
// Setup function, called on page load
setup() {
this.canvas = document.getElementById('plotArea')
// Guard against null canvas (may be unmounted in Verilog mode)
if (!this.canvas) return
if (!embed) {
this.ctx = this.canvas.getContext('2d')
}

// Clear any existing interval to prevent duplicates on remount
if (this.timeOutPlot) {
clearInterval(this.timeOutPlot)
}

this.timeOutPlot = setInterval(() => {
plotArea.plot()
}, frameInterval)
Expand Down Expand Up @@ -439,6 +447,14 @@ const plotArea = {
},
// Driver function to render and update
plot() {
// Check if canvas is available (may be unmounted in Verilog mode)
if (!this.canvas) {
this.canvas = document.getElementById('plotArea')
}
if (!this.canvas) return

if (typeof globalScope === 'undefined' || !globalScope) return

const simulatorMobileStore = useSimulatorMobileStore()
const { showCanvas } = toRefs(simulatorMobileStore)
if (embed) return
Expand All @@ -448,7 +464,7 @@ const plotArea = {
showCanvas.value = false
return
}
showCanvas.value = true
showCanvas.value = true

this.update()
this.render()
Expand Down
12 changes: 5 additions & 7 deletions v1/src/components/Extra.vue
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Circuit Elements Panel -->
<ElementsPanel v-if="!simulatorMobileStore.showMobileView"/>
<ElementsPanel v-if="!simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog"/>
<!-- --------------------------------------------------------------------------------------------- -->

<!-- --------------------------------------------------------------------------------------------- -->
Expand All @@ -23,12 +23,12 @@

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Timing Diagram Panel -->
<TimingDiagramPanel v-if="!simulatorMobileStore.showMobileView" />
<TimingDiagramPanel v-if="!simulatorMobileStore.showMobileView && !simulatorMobileStore.isVerilog" />
<!-- --------------------------------------------------------------------------------------------- -->

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Testbench -->
<TestBenchPanel v-if="!simulatorMobileStore.showMobileView" />
<TestBenchPanel v-show="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
<TestBenchCreator v-if="!simulatorMobileStore.showMobileView" />
<!-- --------------------------------------------------------------------------------------------- -->
Expand All @@ -43,11 +43,9 @@

<!-- --------------------------------------------------------------------------------------------- -->
<!-- Verilog Editor Panel -->
<VerilogEditorPanel v-if="!simulatorMobileStore.showMobileView" />
<VerilogEditorPanel v-show="!simulatorMobileStore.showMobileView || simulatorMobileStore.isVerilog" />


<div id="code-window" class="code-window">
<textarea id="codeTextArea"></textarea>
</div>
<VerilogEditorPanelMobile v-if="simulatorMobileStore.showMobileView && simulatorMobileStore.showVerilogPanel" />
<!-- --------------------------------------------------------------------------------------------- -->

Expand Down
Loading
Loading