This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Lesson1( sw, led ); | |
| input [9:0] sw ; | |
| output [9:0] led ; | |
| assign led=sw; | |
| endmodule | |
| /* | |
| module Lesson1( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| /* | |
| 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}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // LaunchPad(MSP430G2231),StellarisLaunchPad(LM4F120) | |
| // | |
| void setup() { | |
| // initialize the digital pin as an output. | |
| // Pin 14 has an LED connected on most Arduino boards: | |
| pinMode(RED_LED, OUTPUT); | |
| pinMode(GREEN_LED, OUTPUT); | |
| pinMode(PUSH2, INPUT); | |
| } |