Skip to content

Instantly share code, notes, and snippets.

/*
* a mem checker
* when activiated, check memory content according to filler result
* pattern is current bytes already filled
* in 32 data width
* that's 0, 4, 8, 12, 16, ...
*/
module axi_rd #
(
// Width of data bus in bits
/*
* a mem filler
* when activiated, fill a memory region
* with current bytes already filled
* in 32 data width
* that's 0, 4, 8, 12, 16, ...
*/
module axi_wr #
(
// Width of data bus in bits
@neilzheng
neilzheng / fifo.v
Last active November 29, 2025 05:35
module fifo #(
parameter DATA_WIDTH = 8,
parameter BUFFER_DEPTH = 4, // must greater than 4
parameter ADDR_WIDTH = $clog2(BUFFER_DEPTH)
) (
input logic clk,
input logic rst_n,
// Input side (write port)
input logic i_valid,
// Description: Implements various bitwise shift and rotate operations
// (logical, arithmetic, rotate).
module shift_unit
import cpu_defines::*;
(
// Inputs
input logic [XLEN-1:0] shift_in_data, // Data to be shifted/rotated
input logic [SHIFT_WIDTH-1:0] shift_amount, // Number of bit positions to shift/rotate
input shift_ops_t shift_op, // Type of shift/rotate operation
// shift use dsp multiply
module dshift
import cpu_defines::*;
(
input logic [15:0] i_in, // 16-bit input data
input logic [3:0] i_shift_amount, // 4-bit shift amount
input shift_ops_t i_function, // Shift function (SLL_OP, SRL_OP, SRA_OP, ROR_OP)
input logic i_direction, // early decoded direction
output logic [15:0] o_out, // 16-bit output data
output logic o_carry_out, // Carry output
export interface PaginationArgs {
cursorName?: string;
cursor?: number;
forward?: number;
backward?: number;
skipPage?: number;
}
export const loadNewPageArgs = (
totalPage: number,
// pagination.input.ts
import { Field, InputType } from '@nestjs/graphql';
import { IsInt, IsOptional, Max, Min } from 'class-validator';
@InputType()
export class PaginationInput {
// cursor field name
@Field({ nullable: true })
@IsOptional()
cursorName?: string;
const events = ['mousedown', 'mousemove', 'keypress', 'scroll', 'touchstart'];
// tick timer for schedule jobs
// idle timer autoremove it self after stop
export class IdleTickTimer {
private idleCount: number = 0;
private stopIdleCount: number = 0;
private idleTickCallback: { (tick: number, final: boolean): void };
private intervalID: number;
private activityCallback: { (): void } | null;
import { pbkdf2, randomBytes } from 'crypto';
import { promisify } from 'util';
export interface PBKDF2Options {
digest: string;
iterations: number;
keylen?: number;
}
export class PBKDF2 {
'''
batch change tracker for qbittorrent 4.2-
'''
import sys
import os
import glob
import bencode
if __name__ == '__main__':