//
//1.點亮一顆燈
/light one/
//module liushuideng(
//input clk,
//input rst,
//output led
// );
//reg led;
//always @(posedge clk or negedge rst)
//if(!rst) led <= 1'b1;
//else led <= 1'b0;
//endmodule
//2.點亮八顆燈/
//module liushuideng(
//input clk,
//input rst,
//output reg[7:0] led
//);
//always@(posedge clk or negedge rst)
//if(!rst) led <= 8'b1111_1111;
//else led <= 8'b0000_0000;
//endmodule
//3.延遲點亮八顆燈//
//module liushuideng(
//input clk,
//input rst,
//output reg[7:0] led
//);
//reg[27:0] cnt;
//always@(posedge clk or negedge rst)
//if(!rst) cnt <= 28'd0;
//else cnt <= cnt+1'b1;
//always@(posedge clk or negedge rst)
//if(!rst) led <= 8'b1111_1111;
//else if(cnt == 28'hfffffff)
//led <= 8'b0000_0000;
//endmodule
//4.八個燈閃閃
//module liushuideng(
//input clk,
//input rst,
//output reg[7:0] led
//);
//reg[27:0] cnt;
//always@(posedge clk or negedge rst)
//if(!rst) cnt <= 28'd0;
//else if(cnt == 28'hfffffff) cnt <= 28'd0;
//else cnt <= cnt +1'b1;
//always@(posedge clk or negedge rst)
//if(!rst) led <= 8'b1111_1111;
//else if(cnt == 28'hffffffe)
//led <= ~led;
//endmodule
//5.迴圈點亮led燈
//module liushuideng(
//input clk,
//input rst,
//output reg[7:0] led
//);
//reg [27:0] cnt;
//always@(posedge clk or negedge rst)
//if(!rst) cnt <= 28'd0;
//else if(cnt == 28'hfffffff) cnt <= 28'd0;
//else cnt <= cnt+1'b1;
//always@(posedge clk or negedge rst)
//if(!rst) led <= 8'b1111_1110;
//else if(cnt == 28'hffffff) led <=;
//endmodule
這些都是很簡單的例子,只是想說,一點一點慢慢來,從點亮一顆到8顆,再到延遲亮,迴圈亮,由易到難實現,從中一點一點進步
Verilog語言簡息
verilog語言簡息 1 verilog的原始檔主要由 v檔案或者 件組成。2 v檔案一般由乙個或多個模組 module 或函式 functivn 組成。3 一般情況下,乙個模組,乙個檔案,也可以多個模組使用乙個檔案的情況。4 件一般情況下用來儲存全域性的定義,是verilog語法中的標頭檔案,在...
5 verilog語言編寫呼吸燈
1 本節目錄 2 fpga簡介 3 verilog簡介 4 verilog語言編寫呼吸燈 5 本節結束。fpga field programmable gate array 是在pal gal等可程式設計器件的基礎上進一步發展的產物。它是作為專用積體電路 asic 領域中的一種半定製電路而出現的,既...
LED燈驅動的編寫
led燈驅動的編寫 一 原理圖 led2 gpx2 7 led3 gpx1 0 led4 gpf3 4 led5 gpf3 5 輸出 0滅 1亮 二 晶元手冊 gpx2con 0x11000c40 31 28 0x1 gpx2dat 0x11000c44 7 0 1 gpx1con 0x11000c...