Skip to content

Instantly share code, notes, and snippets.

View buttercutter's full-sized avatar

Phung Cheng Fei buttercutter

View GitHub Profile
module detect_start_bit(clk, serial_in, start_detected); // just a falling edge detector
input clk, serial_in;
output reg start_detected = 0;
reg previously_idle = 1;
always @(posedge clk)
begin
if((!serial_in) && (previously_idle) && (!start_detected))
`timescale 1ps/100fs
module baud_generator_tb;
reg clk;
wire baud_out;
baud_generator BG1
(
.clk(clk),
.baud_out(baud_out)
@buttercutter
buttercutter / fifo.c
Last active March 25, 2018 11:07
fifo.c under xillybus_demoapps directory
#include <pthread.h>
#include <semaphore.h>
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/mman.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
module xillydemo
(
input clk_100,
input otg_oc,
inout [55:0] PS_GPIO,
output [3:0] GPIO_LED,
output [3:0] vga4_blue,
output [3:0] vga4_green,
output [3:0] vga4_red,
output vga_hsync,
@buttercutter
buttercutter / base.tcl
Created January 12, 2018 02:20
PYNQ modified TCL setup script for Vivado 2017.2
###############################################################################
# Copyright (c) 2016, Xilinx, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
@buttercutter
buttercutter / test_lpthread.c
Last active January 17, 2018 12:19
Simple multi-threaded application explains how to create apps with multiple threads and also explains about how to deal with args parameter of pthread_create
#include <stdio.h>
#include <pthread.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
#include <stdint.h>
@buttercutter
buttercutter / chnl_tester.v
Last active March 23, 2018 09:47
Modified demo example for http://riffa.ucsd.edu/node/3
// ----------------------------------------------------------------------
// Copyright (c) 2016, The Regents of the University of California All
// rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of conditions and the following disclaimer.
@buttercutter
buttercutter / chnl_convolution.v
Created February 5, 2018 04:36
Sobel convolution for Xilinx ML605 (single channel) example in http://riffa.ucsd.edu/node/16
`timescale 1ns/1ns
//----------------------------------------------------------------------------
// This software is Copyright © 2012 The Regents of the University of
// California. All Rights Reserved.
//
// Permission to copy, modify, and distribute this software and its
// documentation for educational, research and non-profit purposes, without
// fee, and without a written agreement is hereby granted, provided that the
// above copyright notice, this paragraph and the following three paragraphs
// appear in all copies.
@buttercutter
buttercutter / S11.log
Last active April 5, 2019 04:53 — forked from anonymous/S11.log
* gnetlist -g spice-noqsi -o test_active_inductor.net test_active_inductor.sch
AC Analysis Mon Feb 12 23:17:37 2018
--------------------------------------------------------------------------------
Index frequency s11
--------------------------------------------------------------------------------
0 1.000000e+02 9.997594e-01, 1.132451e-13
1 1.001001e+02 9.997594e-01, 1.133585e-13
2 1.002002e+02 9.997594e-01, 1.134718e-13
3 1.003003e+02 9.997594e-01, 1.135852e-13
4 1.004004e+02 9.997594e-01, 1.136985e-13
`default_nettype none
// for connecting Tx and Rx together
`define LOOPBACK 1
module test_UART(reset_tx, reset_rx, serial_out, enable, i_data, o_busy, received_data, data_is_valid, rx_error,
`ifndef FORMAL
clk
`endif);