Skip to content

Instantly share code, notes, and snippets.

View skmp's full-sized avatar

Stefanos Kornilios Mitsis Poiitidis skmp

View GitHub Profile
@skmp
skmp / hls_testbench.cpp
Created March 12, 2021 14:54
FPPAdc: HLS testbench
#include "refrend_hls.h"
#include <stdio.h>
using namespace std;
int main()
{
int err =0;
@skmp
skmp / a-test.cpp
Last active June 10, 2022 09:48
copyable functions
//More details: https://github.com/FEX-Emu/fex-assorted-tests-bins/tree/main/src/copyable-functions
#include <cstdint>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <sys/mman.h>
// Example of creating function specializations at run time from a "canonical" template provided by the compiler
@skmp
skmp / copyable-functions.cpp
Created June 23, 2022 11:07
Copyable Functions v2
// Example of creating function specializations at run time from a "canonical" template provided by the compiler
// More details: https://github.com/FEX-Emu/fex-assorted-tests-bins/tree/main/src/copyable-functions
#include <cstdint>
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <cassert>
#include <tuple>
@skmp
skmp / alloc.cpp
Created August 12, 2022 00:33
Grab address space
// $ gcc alloc.cpp -Wl,-esteal -static -g -fno-stack-protector
//
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <sys/syscall.h>
#include <cerrno>
#include <cstdint>
// ./a.out | aplay -r 256000 ?
#include <stdio.h>
#include <stdint.h>
#include <x86intrin.h>
#include <atomic>
#include <unistd.h>
#include <math.h>
std::atomic<uint8_t> caches[128 * 512 * 64];
@skmp
skmp / test.cpp
Created September 28, 2023 06:28
libclang template arguments via python
template<int x, int y>
void DoSomething() {
// consume x, y as constants
}
void foo() {
DoSomething<0,1>();
DoSomething<640,480>();
@skmp
skmp / sh4_fpu_approx.h
Last active September 20, 2026 07:51
Bit-exact models of the SH7091 / SH7750 (SH-4) vector and approximation FPU instructions
/*
The MIT License (MIT)
Copyright © 2026 Stefanos Kornilios Mitsis Poiitidis
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR