Skip to content

Instantly share code, notes, and snippets.

View dramforever's full-sized avatar
🖤
dramming

dram dramforever

🖤
dramming
  • Scarlet Devil Mansion, Gensokyo
View GitHub Profile
@dramforever
dramforever / register_file.hs
Created September 30, 2019 13:00
Attempt at register file
module Hs8b.Register where
import Clash.Prelude
type Reg = Unsigned 4
type Value = Unsigned 8
{-# ANN registerFileMono Synthesize
{ t_name = "register_file"
, t_inputs = PortName <$> words "clk rst write read"
@dramforever
dramforever / match_goal_forall.coq
Last active February 9, 2020 04:41
Coq: How do I match inside a binder properly?
Ltac detect :=
match goal with
| [ |- context G [ forall x : ?T, _ (* ?E *) ] ] =>
idtac G T; fail
end.
Theorem test : (forall x, x = 1) = (forall x, x = 2).
Proof.
try detect.
(* As shown above: _ matches inside binders expectedly
module Parser where
newtype Parser a = P { parse :: String -> [(a, String)] }
instance Functor Parser where
fmap g p = P (\inp -> case parse p inp of
[] -> []
[(v, out)] -> [(g v, out)])
instance Applicative Parser where
@dramforever
dramforever / new-bios.md
Last active April 21, 2020 05:31
vscode-ghc-simple new bios design

A bit of extra stuff

  • TODO Make on-configuration-change restart more specific
  • TODO Alert users for configuration migration
    • ghcSimple.useObjectCode is gone.
    • ghcSimple.workspaceType is gone.

Considerations not mentioned

  • Configuration options?

dram.like || (wip &amp;&amp; interesting)

@dramforever
dramforever / log.txt
Created October 4, 2020 16:19
Inverting a lookup table
sizeof(int) = 4
RAND_MAX = 2147483647
NUM = 536870911
BLOCK_LEN = 2097152
block = 4.859 s
naive = 6.024 s
1 - (block / naive) = 0.193
block = 4.637 s
naive = 5.826 s
1 - (block / naive) = 0.204
@dramforever
dramforever / _info.md
Last active May 14, 2021 14:59
bachix

bachix

Generate nix.conf for Cachix in bash. Because sometimes it's just unnecessary to download cachix the binary.