Update static/asic-design-code-generator.html
Browse files
static/asic-design-code-generator.html
CHANGED
|
@@ -196,29 +196,33 @@
|
|
| 196 |
</div>
|
| 197 |
|
| 198 |
<div class="row">
|
| 199 |
-
|
| 200 |
-
|
| 201 |
-
|
| 202 |
-
|
| 203 |
-
|
| 204 |
-
|
| 205 |
-
|
| 206 |
-
|
| 207 |
-
|
| 208 |
-
|
| 209 |
-
|
|
|
|
|
|
|
| 210 |
|
| 211 |
-
|
| 212 |
-
|
| 213 |
-
|
| 214 |
-
|
| 215 |
-
|
| 216 |
-
|
| 217 |
-
|
| 218 |
-
|
| 219 |
-
|
| 220 |
-
|
| 221 |
-
|
|
|
|
|
|
|
| 222 |
</div>
|
| 223 |
</div>
|
| 224 |
</body>
|
|
@@ -231,6 +235,10 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 231 |
const generateButton = document.querySelector(".btn-primary");
|
| 232 |
const refineButton = document.querySelector(".btn-success");
|
| 233 |
const generatedCodeOutput = document.getElementById("divGenerated");
|
|
|
|
|
|
|
|
|
|
|
|
|
| 234 |
|
| 235 |
let websocket;
|
| 236 |
|
|
@@ -245,8 +253,21 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 245 |
};
|
| 246 |
}
|
| 247 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 248 |
generateButton.addEventListener("click", () => {
|
| 249 |
-
connectWebSocket("/ws/generate_code")
|
|
|
|
|
|
|
| 250 |
const description = descriptionInput.value;
|
| 251 |
const language = languageSelect.value;
|
| 252 |
websocket.onopen = () => {
|
|
@@ -255,13 +276,37 @@ document.addEventListener("DOMContentLoaded", () => {
|
|
| 255 |
});
|
| 256 |
|
| 257 |
refineButton.addEventListener("click", () => {
|
| 258 |
-
connectWebSocket("/ws/refine_code")
|
|
|
|
|
|
|
| 259 |
const existing_code = generatedCodeOutput.textContent;
|
| 260 |
const language = languageSelect.value;
|
| 261 |
websocket.onopen = () => {
|
| 262 |
websocket.send(JSON.stringify({ existing_code, language }));
|
| 263 |
};
|
| 264 |
});
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 265 |
});
|
| 266 |
|
| 267 |
|
|
|
|
| 196 |
</div>
|
| 197 |
|
| 198 |
<div class="row">
|
| 199 |
+
<div class="col">
|
| 200 |
+
<div class="card">
|
| 201 |
+
<div class="card-header">
|
| 202 |
+
<i class='bx bx-wrench'></i> Optimization & Linting
|
| 203 |
+
</div>
|
| 204 |
+
<div class="card-body">
|
| 205 |
+
<p id="optimization-output">Optimization suggestions will appear here.</p>
|
| 206 |
+
<button class="btn btn-optimize">
|
| 207 |
+
<i class='bx bx-cog'></i> Get Optimization
|
| 208 |
+
</button>
|
| 209 |
+
</div>
|
| 210 |
+
</div>
|
| 211 |
+
</div>
|
| 212 |
|
| 213 |
+
<div class="col">
|
| 214 |
+
<div class="card">
|
| 215 |
+
<div class="card-header">
|
| 216 |
+
<i class='bx bx-bug'></i> Failure Modes & Test Benches
|
| 217 |
+
</div>
|
| 218 |
+
<div class="card-body">
|
| 219 |
+
<p id="test-bench-output">Test bench suggestions will appear here.</p>
|
| 220 |
+
<button class="btn btn-test-bench">
|
| 221 |
+
<i class='bx bx-test-tube'></i> Generate Test Bench
|
| 222 |
+
</button>
|
| 223 |
+
</div>
|
| 224 |
+
</div>
|
| 225 |
+
</div>
|
| 226 |
</div>
|
| 227 |
</div>
|
| 228 |
</body>
|
|
|
|
| 235 |
const generateButton = document.querySelector(".btn-primary");
|
| 236 |
const refineButton = document.querySelector(".btn-success");
|
| 237 |
const generatedCodeOutput = document.getElementById("divGenerated");
|
| 238 |
+
const optimizeButton = document.querySelector(".btn-optimize");
|
| 239 |
+
const testBenchButton = document.querySelector(".btn-test-bench");
|
| 240 |
+
const optimizationOutput = document.querySelector("#optimization-output");
|
| 241 |
+
const testBenchOutput = document.querySelector("#test-bench-output");
|
| 242 |
|
| 243 |
let websocket;
|
| 244 |
|
|
|
|
| 253 |
};
|
| 254 |
}
|
| 255 |
|
| 256 |
+
function connectWebSocket(endpoint, onMessageCallback) {
|
| 257 |
+
const protocol = window.location.protocol === "https:" ? "wss://" : "ws://";
|
| 258 |
+
websocket = new WebSocket(`${protocol}${window.location.host}${endpoint}`);
|
| 259 |
+
websocket.onmessage = (event) => {
|
| 260 |
+
onMessageCallback(event.data);
|
| 261 |
+
};
|
| 262 |
+
websocket.onclose = () => {
|
| 263 |
+
console.log("WebSocket connection closed");
|
| 264 |
+
};
|
| 265 |
+
}
|
| 266 |
+
|
| 267 |
generateButton.addEventListener("click", () => {
|
| 268 |
+
connectWebSocket("/ws/generate_code",(data) => {
|
| 269 |
+
generatedCodeOutput.innerHTML = marked.parse( data);
|
| 270 |
+
});
|
| 271 |
const description = descriptionInput.value;
|
| 272 |
const language = languageSelect.value;
|
| 273 |
websocket.onopen = () => {
|
|
|
|
| 276 |
});
|
| 277 |
|
| 278 |
refineButton.addEventListener("click", () => {
|
| 279 |
+
connectWebSocket("/ws/refine_code",(data) => {
|
| 280 |
+
generatedCodeOutput.innerHTML = marked.parse( data);
|
| 281 |
+
});
|
| 282 |
const existing_code = generatedCodeOutput.textContent;
|
| 283 |
const language = languageSelect.value;
|
| 284 |
websocket.onopen = () => {
|
| 285 |
websocket.send(JSON.stringify({ existing_code, language }));
|
| 286 |
};
|
| 287 |
});
|
| 288 |
+
|
| 289 |
+
optimizeButton.addEventListener("click", () => {
|
| 290 |
+
connectWebSocket("/ws/optimize_code", (data) => {
|
| 291 |
+
optimizationOutput.innerHTML = marked.parse( data);
|
| 292 |
+
});
|
| 293 |
+
const code = generatedCodeOutput.textContent;
|
| 294 |
+
const language = languageSelect.value;
|
| 295 |
+
websocket.onopen = () => {
|
| 296 |
+
websocket.send(JSON.stringify({ code, language }));
|
| 297 |
+
};
|
| 298 |
+
});
|
| 299 |
+
|
| 300 |
+
testBenchButton.addEventListener("click", () => {
|
| 301 |
+
connectWebSocket("/ws/generate_test_bench", (data) => {
|
| 302 |
+
testBenchOutput.innerHTML = marked.parse( data);
|
| 303 |
+
});
|
| 304 |
+
const code = generatedCodeOutput.textContent;
|
| 305 |
+
const language = languageSelect.value;
|
| 306 |
+
websocket.onopen = () => {
|
| 307 |
+
websocket.send(JSON.stringify({ code, language }));
|
| 308 |
+
};
|
| 309 |
+
});
|
| 310 |
});
|
| 311 |
|
| 312 |
|