Skip to content

Instantly share code, notes, and snippets.

View tmm88's full-sized avatar

tiagomoraismorgado tmm88

View GitHub Profile
@tmm88
tmm88 / THREEJSDATAVISUALIZATION.js
Created September 8, 2025 09:48
THREEJSDATAVISUALIZATION.js
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width,initial-scale=1" />
<title>Particles + von Mises stress demo</title>
<style>
html,body { height:100%; margin:0; background:#0b0b0b; color:#ddd; font-family:Helvetica,Arial; }
canvas { display:block; width:100vw; height:100vh; }
#ui { position: absolute; left:12px; top:12px; z-index:10; background:rgba(0,0,0,0.4); padding:8px; border-radius:6px; font-size:13px; }
@tmm88
tmm88 / soliditySimpleContract.sol
Last active September 8, 2025 08:38
soliditySimpleContract.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
// Note: Removed MerkleProof import as we're implementing a recursive verification function.
// Inspired by the Austrian School of Economics, this contract emphasizes decentralized verification
// and individual action in maintaining sequence integrity.
@tmm88
tmm88 / OpenClDSPcpp.cpp
Created September 7, 2025 16:09
OpenClDSPcpp.cpp
// OpenCL for FPGAs is already a form of HLS, similar to C/C++ HLS or MyHDL.
// The previous OpenCL kernel provided is suitable; it can be compiled with tools like Intel FPGA OpenCL SDK or Xilinx SDAccel/Vitis.
// For similarity to HLS/MyHDL, note that OpenCL kernels describe parallel hardware, like MyHDL modules or HLS functions with pragmas.
// No major changes needed, but here's an adjusted version with fixed-point for better FPGA fit.
// Adjusted Kernel
#define NUM_OSC 32
#define PI 3.141592653589793f
#define AMP 0.06f
#define FIXED_WIDTH 16
@tmm88
tmm88 / pythonMyHDLdsp07092025.py
Created September 7, 2025 16:07
pythonMyHDLdsp07092025.py
# MyHDL Python code for hardware description of the audio synthesizer.
# This generates Verilog/VHDL for FPGA. For sine, uses a LUT-based DDS.
# Frequency sweep implemented by linearly increasing phase increment.
# Host/CPU would generate random params, configure via registers.
# Assumes fixed-point, 16-bit output. Mixes 32 oscillators.
from myhdl import *
import math
def audio_synth(clk, reset, start_phase_inc, end_phase_inc, audio_out, sample_rate=44100, duration=60):
@tmm88
tmm88 / DSP070920251.cpp
Created September 7, 2025 16:06
DSP070920251.cpp
// Example Vitis HLS C++ code for synthesizing the audio generator to FPGA RTL.
// This is a top-level function that generates a buffer of mixed sine sweep samples.
// Host code (not shown) would generate random freqs, call the kernel via Vitis API, stream to audio.
// Use fixed-point for better FPGA efficiency; here using float for simplicity.
// Include <hls_math.h> for sinf().
#include <hls_stream.h>
#include <hls_math.h>
#include <ap_fixed.h>
@tmm88
tmm88 / thermalAdjust.ps1
Created September 7, 2025 09:55
thermalAdjust.ps1
# PowerShell script to decrease fan speed and increase thermal dissipator speed
# Requires administrative privileges and compatible hardware/software
# Ensure the script runs with elevated privileges
if (-not ([Security.Principal.WindowsPrincipal] [Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole]::Administrator)) {
Write-Error "This script requires administrative privileges. Please run as Administrator."
exit
}
# Function to set fan speed (example using WMI, adjust for your hardware)
@tmm88
tmm88 / solidityContrat07092025.sol
Last active September 7, 2025 09:37
solidityContrat07092025.sol
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import "@openzeppelin/contracts/access/Ownable2Step.sol";
import "@openzeppelin/contracts/utils/cryptography/MerkleProof.sol";
import "@openzeppelin/contracts/utils/structs/BitMaps.sol";
import "@openzeppelin/contracts/utils/ReentrancyGuard.sol";
/// @title Advanced A336975 Sequence Storage with Batch Processing
/// @notice Implements a gas-efficient, verifiable storage for OEIS sequence A336975
@tmm88
tmm88 / 1_1.cpp
Last active September 6, 2025 10:30
DSPRoutineFPGA1_3.cpp
// OpenCL kernel for tone generator
__kernel void tone_generator(__global float *output, __global float *osc_freq, __global float *lfo_freq, __global float *phase, __global float *lfo_phase) {
const int NUM_OSC = 32;
const float SAMPLE_RATE = 48000.0f;
const float TWO_PI = 6.28318530718f;
const float AMPLITUDE = 0.01f;
// Get global ID for parallel processing
int gid = get_global_id(0);
float sum = 0.0f;
@tmm88
tmm88 / 1.py
Last active September 6, 2025 10:29
DSPRoutineFPGA1_2.py
from myhdl import block, Signal, intbv, always_comb, always_seq, delay
import math
@block
def tone_generator(clk, reset, output):
# Parameters
NUM_OSC = 32
SAMPLE_RATE = 48000
TWO_PI = 2 * math.pi
BIT_WIDTH = 16
@tmm88
tmm88 / 1.cpp
Last active September 6, 2025 10:29
DSPRoutineFPGA1_1.cpp
#include <hls_math.h>
#include <ap_fixed.h>
// Define fixed-point types for FPGA efficiency
typedef ap_fixed<16, 4> fixed_t; // 16-bit fixed-point, 4 integer bits
const int NUM_OSC = 32;
const float SAMPLE_RATE = 48000.0; // Audio sample rate (Hz)
const float TWO_PI = 6.28318530718;
// Precomputed random frequencies and LFO rates (generated offline)