Skip to content

Instantly share code, notes, and snippets.

View fcayci's full-sized avatar

Furkan Cayci fcayci

  • Newark, DE
View GitHub Profile
import numpy as np
from PIL import Image as im
a = im.open('s2.png')
b = np.array(a)
print('loaded image with shape:', b.shape)
# print color matrix
for i in range(b.shape[0]):
@fcayci
fcayci / lab1.vhd
Last active October 4, 2019 13:40
fpga course lab1 vhdl
-- Lab1 for FPGA course
library ieee;
use ieee.std_logic_1164.all;
entity lab1 is
-- btns are inputs of the circuit
-- leds are outputs of the circuit
port (
btn : in std_logic_vector(3 downto 0);
led : out std_logic_vector(3 downto 0)
@fcayci
fcayci / full_adder.vhd
Created October 2, 2019 10:03
ELEC457 - Lecture 2 LAB
-- 1-bit full adder
library ieee;
use ieee.std_logic_1164.all;
entity full_adder is
-- x, y, cin are inputs of the adder
-- s (sum), cout (carry) are outputs of the adder
port ( x, y : in std_logic; cin : in std_logic;
s : out std_logic; cout : out std_logic );
end full_adder;
@fcayci
fcayci / arty-z720.xdc
Created September 18, 2019 10:48
XDC files for Arty and Pynq boards
## This file is a general .xdc for the ARTY Z7-20 Rev.B
## To use it in a project:
## - uncomment the lines corresponding to used pins
## - rename the used ports (in each line, after get_ports) according to the top level signal names in the project
## Clock Signal
#set_property -dict { PACKAGE_PIN H16 IOSTANDARD LVCMOS33 } [get_ports { clk }]; #IO_L13P_T2_MRCC_35 Sch=SYSCLK
#create_clock -add -name sys_clk_pin -period 8.00 -waveform {0 4} [get_ports { clk }];#set
## Switches
@fcayci
fcayci / memtest.c
Last active December 5, 2018 09:00
xilinx sdk memory test for bram
#include <stdio.h>
#include "xparameters.h"
#include "platform.h"
#include "xil_printf.h"
// Get these from xparamters.h
#define BRAMBASE XPAR_BRAM_0_BASEADDR
#define BRAMHIGH XPAR_BRAM_0_HIGHADDR
int main()
@fcayci
fcayci / gpio_test.c
Last active March 23, 2019 05:51
xilinx sdk gpio test
/*
* gpio_test.c
*
* Created on: Nov 23, 2018
* Author: fcayci
*/
#include <stdio.h>
#include "xparameters.h"
#include "xil_printf.h"
@fcayci
fcayci / fsm_tb.vhd
Created November 1, 2018 09:19
fsm testbench
library ieee;
use ieee.std_logic_1164.all;
entity fsm_tb is
end fsm_tb;
architecture rtl of fsm_tb is
component fsma is
port(
clk, rst : in std_logic;
@fcayci
fcayci / constraints.xdc
Last active October 22, 2019 12:06
counter example part 2
## This file is a general .xdc for the Arty-Z20, PYQN-Z1 and PYNQ-Z2 boards
## Clock signal 125 MHz
set_property -dict { PACKAGE_PIN H16 IOSTANDARD LVCMOS33 } [get_ports { clk }]; #IO_L13P_T2_MRCC_35 Sch=sysclk
create_clock -add -name sys_clk_pin -period 8.00 -waveform {0 4} [get_ports { clk }];
##Switches
#set_property -dict { PACKAGE_PIN M20 IOSTANDARD LVCMOS33 } [get_ports { sw[0] }]; #IO_L7N_T1_AD2N_35 Sch=sw[0]
@fcayci
fcayci / counter.vhd
Last active October 22, 2019 13:33
circuit, testbench and constraints file for a simple 4-bit counter. Used as an in-class example.
library ieee;
use ieee.std_logic_1164.all;
use ieee.numeric_std.all;
entity counter is
port (
clk, rst, en : in std_logic;
count : out std_logic_vector(3 downto 0)
);
end counter;
@fcayci
fcayci / makefile
Created October 24, 2018 19:50
ghdl makefile
# Make sure ghdl and gtkwave is in your PATH
SRCS = design.vhd
TB = design_tb.vhd
CC = ghdl
SIM = gtkwave
ARCHNAME=$(shell grep architecture $(TB) | cut -f 4 -d ' ')
SIMNAME = wave.vcd