Skip to content

Instantly share code, notes, and snippets.

View houmei's full-sized avatar

Katunori Takesita houmei

View GitHub Profile
@houmei
houmei / Lesson1.v
Created January 23, 2013 15:18
DE0 SW0-9 LED0-9 test
module Lesson1( sw, led );
input [9:0] sw ;
output [9:0] led ;
assign led=sw;
endmodule
/*
module Lesson1(
@houmei
houmei / DE0_pinassign.csv
Created January 24, 2013 11:51
DE0 Onboard I/O pinassign
DE0 Pin Assign Direction Pin name Description 02:20130124 @houmei
# CLOCK
CLOCK_50 input PIN_G21(CLK4) 50MHz OSC
CLOCK_50_2 input PIN_B12(CLK9) 50MHz OSC
GPIO0_CLKIN0 input PIN_AB12(CLK12) GPIO0(J4-1)
GPIO0_CLKIN2 input PIN_AB12(CLK13) GPIO0(J4-3)
GPIO_CLKOUT0 output PIN_AB3(PLL1_CLKOUTn) GPIO0(J4-19)
GPIO_CLKOUT1 output PIN_AA3(PLL1_CLKOUTp) GPIO0(J4-21)
GPIO1_CLKIN0 input PIN_AB11(CLK14) GPIO1(J5-1)
// terasIC DE0 topmodule skeleton
// onboard I/O 3-button,10-sw,10-LED,4-7SEG
//
module Skeleton(clk,btn,sw,led,hled0,hled1,hled2,hled3,lcd_bl);
input clk;
input [2:0] btn;
input [9:0] sw;
output [9:0] led;
output [7:0] hled0;
output [7:0] hled1;
@houmei
houmei / bcdall0.v
Created January 27, 2013 16:52
FizzBuzz by FPGA DE0 (QuartusII,verilog)
module bcdall0(BCD3,BCD2,BCD1,BCD0, lampoff);
input [3:0] BCD3;
input [3:0] BCD2;
input [3:0] BCD1;
input [3:0] BCD0;
output lampoff;
assign lampoff=(BCD0==4'd0)&(BCD1==4'd0)&(BCD2==4'd0)&(BCD3==4'd0);
endmodule
@houmei
houmei / keymatrixscan.ino
Created February 7, 2013 23:34
Arduino 4x4 key matrix read
int KO[4]={5,6,7,8};
int KI[4]={9,10,11,12};
void setup() {
pinMode(KI[0],INPUT_PULLUP);
pinMode(KI[1],INPUT_PULLUP);
pinMode(KI[2],INPUT_PULLUP);
pinMode(KI[3],INPUT_PULLUP);
pinMode(KO[0],OUTPUT);
@houmei
houmei / SHFTER.v
Last active January 9, 2022 07:32
QuartusII 12.1 barrel shifter Example
module SHFTER(clk,GPIO1,GPIO2,GPIO3);
input clk;
input [63:0] GPIO1;
input [63:0] GPIO2;
output [63:0] GPIO3;
wire [63:0] indata;
wire [63:0] val;
wire [63:0] sftout;
@houmei
houmei / SHFTER.v
Created May 5, 2013 22:13
QuartusII 12.1 BarrelShifter comparison
module SHFTER(clk,GPIO1,GPIO2,GPIO3);
input clk;
input [63:0] GPIO1;
input [63:0] GPIO2;
output [63:0] GPIO3;
wire [63:0] indata;
wire [63:0] val;
wire [63:0] sftout;
@houmei
houmei / sll64_8_8.v
Created May 8, 2013 16:46
barrel shifter byte-shift then bit-shift QuartusII DE0 target 207LE/284.41MHz
module sll64_byte (indata,val_nnnnxxx,outdata);
input [63:0] indata;
input [3:0] val_nnnnxxx; // shift
output [63:0] outdata;
assign outdata=indata<<(val_nnnnxxx<<3);
endmodule
module sll64_8bit (indata,val,outdata);
input [63:0] indata;
input [2:0] val; // shift 0-7
@houmei
houmei / sll64_8_8.v
Created May 10, 2013 16:08
sll 64bit 1byte-shift then 3bit shift QuartusII 12.1 427LE/185.84MHz
/*
module sll64_byte (indata,val_nnnnxxx,outdata);
input [63:0] indata;
input [3:0] val_nnnnxxx; // shift
output [63:0] outdata;
wire [6:0] shift_v;
assign shift_v={val_nnnnxxx,3'b000};
@houmei
houmei / msp430blink.ino
Created August 18, 2013 15:20
Blink Example for LaunchPad(MSP430) & Stellaris LaunchPad by Energia