Skip to content

Instantly share code, notes, and snippets.

TESTBENCH = u232c_in_tb u232c_out_tb u232c_byteio_tb
OBJECTS = u232c_in.o u232c_out.o u232c_byteio.o \
u232c_in_tb.o u232c_out_tb.o u232c_byteio_tb.o \
byte_processor.o
GHDLC = ghdl
GHDLFLAGS = -fexplicit --ieee=synopsys
GHDL_SIM_OPT = --stop-time=1ms --ieee-asserts=disable
.PHONY: clean
uint23_t inner(size_t n, uint32_t *a, uint32_t *b) {
// n:$16 a:$17 b:$18
uint32_t r = 0; // $0
while (n != 0) {
n--;
r += (*a)*(*b);
a++;
b++;
}
}
@zeptometer
zeptometer / bf.pl
Last active August 29, 2015 14:03
bf_([], _, [], _, _, _, _).
bf_([plus | Ops], In, Out, Stack, Cur, Left, Right) :- Val is Cur+1, bf_(Ops, In, Out, Stack, Val, Left, Right).
bf_([minus | Ops], In, Out, Stack, Cur, Left, Right) :- Val is Cur-1, bf_(Ops, In, Out, Stack, Val, Left, Right).
bf_([next | Ops], In, Out, Stack, Cur, Left, []) :- bf_(Ops, In, Out, Stack, 0, [Cur|Left], []).
bf_([next | Ops], In, Out, Stack, Cur, Left, [Next|Right]) :- bf_(Ops, In, Out, Stack, Next, [Cur|Left], Right).
bf_([prev | Ops], In, Out, Stack, Cur, [], Right) :- bf_(Ops, In, Out, Stack, 0, [], [Cur|Right]).
bf_([prev | Ops], In, Out, Stack, Cur, [Next|Left], Right) :- bf_(Ops, In, Out, Stack, Next, Left, [Cur|Right]).
bf_([get | Ops], [], Out, Stack, _, Left, Right) :- bf_(Ops, [], Out, Stack, 0, Left, Right).
bf_([get | Ops], [C|In], Out, Stack, _, Left, Right) :- bf_(Ops, In, Out, Stack, C, Left, Right).
bf_([put | Ops], In, [Cur|Out], Stack, Cur, Left, Right) :- bf_(Ops, In, Out, Stack, Cur, Left,
(syntax-rules () ((when test stmt1 stmt2 ...) (if test (begin stmt1 stmt2 ...))))
; expand to
(er-macro-transformer@187
(lambda (expr rename cmp)
(let@265 ((test/0 ()) (stmt1/0 ()) (stmt2/1 ()))
(let@265 ((result (call/cc@152 (lambda (exit) (let@265 ((expr (cdr@8 expr))) (begin (if (pair?@5 expr) (let@265 ((expr (car@7 expr))) (set! test/0 expr)) (exit #f)) (if (pair?@5 (cdr@8 expr)) (let@265 ((expr (car@7 (cdr@8 expr)))) (set! stmt1/0 expr)) (exit #f)) (let@265 ((expr (let@265 loop ((a ()) (d (cdr@8 (cdr@8 expr)))) (if (pair?@5 d) (loop (cons@6 (car@7 d) a) (cdr@8 d)) (cons@6 d a))))) (begin (let@265 ((expr (car@7 expr))) (if (not@3 (eqv?@1 '() expr)) (exit #f))) (let@265 ((expr (cdr@8 expr))) (let@265 loop ((expr expr)) (if (not@3 (null?@15 expr)) (let@265 ((stmt2/0 '())) (let@265 ((expr (car@7 expr))) (set! stmt2/0 expr)) (set! stmt2/1 (cons@6 stmt2/0 stmt2/1)) (loop (cdr@8 expr))))))))) #t)))))
(if result
(quasiquote@328 ((unquote@460 (rena
> (let ((x 1))
* (cond ((even? x) => (lambda (m) m))
* (else x)))
=> #f
> (macroexpand '(let ((x 1))
* (cond ((even? x) => (lambda (m) m))
* (else x)))
* )
=> ((lambda (x@2472) ((lambda (x@2473)
(if x@2473
(define (subst old new tree)
(cond ((eq? old tree) new)
((pair? tree)
(cons (subst old new (car tree))
(subst old new (cdr tree))))
(else tree)))
(define-syntax x2y
(ir-macro-transformer
(lambda (form r compare)
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
library work;
use work.utility.all;
entity fadd is
port ( clk : in std_logic;
i1 : in unsigned(31 downto 0);
(define-syntax hoge
(er-macro-transformer (lambda (expr rename compare)
(list (rename 'quote)
(rename 'list)))))
(hoge)
; => (list@29)
(define-syntax quota
(syntax-rules ()
((_ a) 'a)))
(define-syntax hoge
(syntax-rules ()
((_) (quota tako))))
@zeptometer
zeptometer / sshterminal.js
Created December 5, 2014 14:24
リモートマシンからX転送でプログラムを実行するあれ
var sh = new ActiveXObject( "WScript.Shell" );
sh.Run("C:\\cygwin64\\bin\\ssh.exe -Y cetinje \"LANG=ja_JP.utf-8 lxterminal\"", 0);