Skip to content

Commit 130a5aa

Browse files
committed
examples/vhdl/vue: add Vue.js project and websim.py
1 parent 8d09640 commit 130a5aa

15 files changed

Lines changed: 9124 additions & 0 deletions

File tree

examples/vhdl/vue/.gitignore

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
.DS_Store
2+
node_modules
3+
/dist
4+
5+
# local env files
6+
.env.local
7+
.env.*.local
8+
9+
# Log files
10+
npm-debug.log*
11+
yarn-debug.log*
12+
yarn-error.log*
13+
14+
# Editor directories and files
15+
.idea
16+
.vscode
17+
*.suo
18+
*.ntvs*
19+
*.njsproj
20+
*.sln
21+
*.sw?

examples/vhdl/vue/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# hls_master
2+
3+
## Project setup
4+
```
5+
yarn install
6+
```
7+
8+
### Compiles and hot-reloads for development
9+
```
10+
yarn run serve
11+
```
12+
13+
### Compiles and minifies for production
14+
```
15+
yarn run build
16+
```
17+
18+
### Run your tests
19+
```
20+
yarn run test
21+
```
22+
23+
### Lints and fixes files
24+
```
25+
yarn run lint
26+
```
27+
28+
### Customize configuration
29+
See [Configuration Reference](https://cli.vuejs.org/config/).

examples/vhdl/vue/babel.config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
module.exports = {
2+
presets: [
3+
'@vue/app'
4+
]
5+
}

examples/vhdl/vue/package.json

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
{
2+
"name": "VUnitCoSim",
3+
"version": "0.1.0",
4+
"private": true,
5+
"scripts": {
6+
"serve": "vue-cli-service serve",
7+
"build": "vue-cli-service build",
8+
"lint": "vue-cli-service lint"
9+
},
10+
"dependencies": {
11+
"@mdi/font": "^3.6.95",
12+
"buefy": "^0.7.5",
13+
"core-js": "^2.6.8",
14+
"vue": "^2.6.10",
15+
"vue-resource": "^1.5.1"
16+
},
17+
"devDependencies": {
18+
"@vue/cli-plugin-babel": "^3.7.0",
19+
"@vue/cli-plugin-eslint": "^3.7.0",
20+
"@vue/cli-service": "^3.7.0",
21+
"babel-eslint": "^10.0.1",
22+
"eslint": "^5.16.0",
23+
"eslint-plugin-vue": "^5.0.0",
24+
"sass": "^1.19.0",
25+
"sass-loader": "^7.1.0",
26+
"vue-template-compiler": "^2.5.21"
27+
},
28+
"eslintConfig": {
29+
"root": true,
30+
"env": {
31+
"node": true
32+
},
33+
"extends": [
34+
"plugin:vue/essential",
35+
"eslint:recommended"
36+
],
37+
"rules": {},
38+
"parserOptions": {
39+
"parser": "babel-eslint"
40+
}
41+
},
42+
"postcss": {
43+
"plugins": {
44+
"autoprefixer": {}
45+
}
46+
},
47+
"browserslist": [
48+
"> 1%",
49+
"last 2 versions"
50+
]
51+
}
4.19 KB
Binary file not shown.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<!DOCTYPE html>
2+
<html lang="en">
3+
<head>
4+
<meta charset="utf-8">
5+
<meta http-equiv="X-UA-Compatible" content="IE=edge">
6+
<meta name="viewport" content="width=device-width,initial-scale=1.0">
7+
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
8+
<title>VUnitCoSim</title>
9+
</head>
10+
<body>
11+
<noscript>
12+
<strong>We're sorry but VUnitCoSim doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
13+
</noscript>
14+
<div id="app"></div>
15+
<!-- built files will be auto injected -->
16+
</body>
17+
</html>

examples/vhdl/vue/src/App.vue

Lines changed: 170 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,170 @@
1+
<template>
2+
<div id="app">
3+
<NavBar
4+
v-on:load="load"
5+
:name.sync="name"
6+
:params.sync="params"
7+
:loaded.sync="loaded"
8+
:busy.sync="busy"
9+
:finished.sync="finished"
10+
/>
11+
12+
<section class="hero" v-if="!loaded">
13+
<div class="hero-body">
14+
<div class="container has-text-centered">
15+
<h1 class="title">
16+
No design loaded, yet
17+
</h1>
18+
<h2 class="subtitle">
19+
Turn the switch on to start the simulation.
20+
</h2>
21+
</div>
22+
</div>
23+
</section>
24+
</div>
25+
</template>
26+
27+
<script>
28+
import Vue from 'vue'
29+
30+
import VueResource from 'vue-resource'
31+
Vue.use(VueResource);
32+
33+
import "@mdi/font/css/materialdesignicons.css";
34+
35+
import Buefy from "buefy";
36+
import "buefy/dist/buefy.css";
37+
Vue.use(Buefy);
38+
39+
import NavBar from "@/components/NavBar.vue";
40+
41+
export default {
42+
name: 'app',
43+
components: {
44+
NavBar
45+
},
46+
data() {
47+
return {
48+
name: '',
49+
params: [0, 0, 0],
50+
data: {},
51+
loaded: false,
52+
polling: null,
53+
busy: false,
54+
finished: false
55+
};
56+
},
57+
methods: {
58+
setPolling () {
59+
this.polling = setInterval(() => {
60+
this.$http.get('/api/update').then((r) => {
61+
if (r.status === 200) {
62+
console.log('UPDATE', r.body)
63+
this.loaded = true;
64+
var u = r.body['update']
65+
if (u != 0) {
66+
this.name = r.body.name;
67+
this.params = r.body.params;
68+
this.data = r.body.data;
69+
this.busy = false;
70+
var msg = 'Data updated!'
71+
if (u == 2) {
72+
this.finished = true;
73+
msg = 'Simulation finished!'
74+
}
75+
this.$toast.open({
76+
duration: 2000,
77+
message: msg,
78+
position: 'is-bottom',
79+
type: 'is-warning'
80+
})
81+
}
82+
} else {
83+
alert('Request failed. Returned status of ' + r.status);
84+
}
85+
})
86+
}, 2000);
87+
},
88+
load (v) {
89+
if (v === true) {
90+
this.setPolling();
91+
this.busy = true;
92+
this.$http.get('/api/load').then((r) => {
93+
if (r.status === 200) {
94+
console.log('LOAD', r.body)
95+
} else {
96+
alert('Request failed. Returned status of ' + r.status);
97+
}
98+
});
99+
} else {
100+
clearInterval(this.polling);
101+
this.$http.get('/api/unload').then((r) => {
102+
if (r.status === 200) {
103+
console.log('UNLOAD', r.body)
104+
} else {
105+
alert('Request failed. Returned status of ' + r.status);
106+
}
107+
})
108+
}
109+
},
110+
}
111+
}
112+
</script>
113+
114+
<style>
115+
#app {
116+
font-family: 'Avenir', Helvetica, Arial, sans-serif;
117+
-webkit-font-smoothing: antialiased;
118+
-moz-osx-font-smoothing: grayscale;
119+
text-align: center;
120+
color: #2c3e50;
121+
margin-top: 60px;
122+
}
123+
</style>
124+
125+
<style lang="scss">
126+
@import "~bulma";
127+
@import "~buefy/src/scss/buefy";
128+
129+
@font-face {
130+
font-family: BigJohnPRORegular;
131+
src: url("assets/fonts/BigJohnPRO-Regular.otf");
132+
}
133+
@font-face {
134+
font-family: BigJohnPROLight;
135+
src: url("assets/fonts/BigJohnPRO-Light.otf");
136+
}
137+
@font-face {
138+
font-family: BigJohnPROBold;
139+
src: url("assets/fonts/BigJohnPRO-Bold.otf");
140+
}
141+
/*
142+
html,
143+
body,
144+
#app {
145+
height: 100%;
146+
max-height: 100%;
147+
background-color: #f2f1ef;
148+
}
149+
#view {
150+
flex-grow: 1;
151+
}
152+
#app {
153+
font-family: "Fenix", "Avenir", Helvetica, Arial, sans-serif;
154+
-webkit-font-smoothing: antialiased;
155+
-moz-osx-font-smoothing: grayscale;
156+
text-align: center;
157+
color: #202a33;
158+
display: flex;
159+
flex-direction: column;
160+
}
161+
.nothome {
162+
padding-top: 56px;
163+
}
164+
hr {
165+
height: 1px;
166+
background-color: #ec563c;
167+
margin: 1rem 0;
168+
}
169+
*/
170+
</style>
23.7 KB
Binary file not shown.
23.2 KB
Binary file not shown.
23 KB
Binary file not shown.

0 commit comments

Comments
 (0)