From ec585ba33f61381e5b2095c2386083ea843b2c47 Mon Sep 17 00:00:00 2001 From: ZoRo Date: Fri, 27 Aug 2021 09:32:54 +0100 Subject: Demo wasm page --- Build/index.html | 86 +++++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 73 insertions(+), 13 deletions(-) (limited to 'Build/index.html') diff --git a/Build/index.html b/Build/index.html index 8f510ac..1a571f7 100644 --- a/Build/index.html +++ b/Build/index.html @@ -17,18 +17,23 @@ .then(response => response.arrayBuffer() ).then(buffer => { - Module.canvas = document.getElementById("canvas"); + //Module.canvas = document.getElementById("canvas"); Module.wasmBinary = buffer; var script = document.createElement('script'); script.src = "index.js"; script.onload = function() { console.log("Emscripten boilerplate loaded."); run_dft = Module.cwrap("dft", [],[['float'],['float'],'number','number']); - run_fft= Module.cwrap( "fft_1",[],[['float'],['float'],'number','number']); + run_fft= Module.cwrap("fft_1",[],[['float'],['float'],'number','number']); - var inputData = document.querySelector('.inputData'); + var inputDataI = document.querySelector('.inputDataI'); + var inputDataIerr = document.querySelector('.inputDataIerr'); + var inputDataQ = document.querySelector('.inputDataQ'); + var inputDataQerr = document.querySelector('.inputDataQerr'); + var outputDataI = document.querySelector('.outputDataI'); + var outputDataQ = document.querySelector('.outputDataQ'); document.querySelector("#calcButton").onclick = function() { console.log("calc FFT"); @@ -42,18 +47,67 @@ } } - var strArr = inputData.value; - strArr = strArr.replace(/ +(?= )/g,''); - var splArr = strArr.split(" "); - if (splArr.some(i => i != parseFloat(i))) { - throw i + " is not integer" + function checkArr(inputData,errorOutput) { + var strArr = inputDataI.value; + + strArr = strArr.replace(/ +(?= )/g,''); + var splArr = strArr.split(" "); + var data = Array(splArr.length).fill(0); + for (let i=0; i - FFT demo - - + + + FFT demo, max value N=8
+ Input I:
+ Input Q:
+ Output I:
+ Output Q:
+