verilog hdl 时序逻辑电路0
2017-05-06 15:24
239 查看
testshixu.v
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:48:22 05/06/2017
// Design Name:
// Module Name: testshixu
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module testshixu(iClk,oLed,rst);
//endmodule
//module led_run(iClk,oLed,rst);
input iClk;
input rst;
output [3:0] oLed;
reg [3:0] oLed;
reg [1:0] count;
reg [1:0] state;
wire clk;
always @(posedge iClk or negedge rst)
begin
if(!rst)
count = 0;
else
count = count+1;
end
//assign clk=count[1];
always @(posedge iClk or negedge rst)
begin
if(!rst)
oLed <=4'b0000;
else
begin
case(count)
2'b00: oLed<=4'b0001;
2'b01: oLed<=4'b0010;
2'b10: oLed<=4'b0100;
2'b11: oLed<=4'b1000;
endcase
//state=state+1;
end
end
endmodule
test_testshixu.v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:00:03 05/06/2017
// Design Name: testshixu
// Module Name: D:/ise147/prj/testshixu/test.v
// Project Name: testshixu
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: testshixu
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module test;
// Inputs
reg iClk;
reg rst;
// Outputs
wire [3:0] oLed;
//reg [1:0] state;
// Instantiate the Unit Under Test (UUT)
testshixu uut (
.iClk(iClk),
.oLed(oLed),
.rst(rst)
);
initial
begin
iClk = 1'b0;
rst = 1'b0;
#5
iClk = 1'b1;
rst = 1'b1;
end
always #10
iClk = ~iClk;
endmodule
`timescale 1ns / 1ps
//////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 11:48:22 05/06/2017
// Design Name:
// Module Name: testshixu
// Project Name:
// Target Devices:
// Tool versions:
// Description:
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
//////////////////////////////////////////////////////////////////////////////////
module testshixu(iClk,oLed,rst);
//endmodule
//module led_run(iClk,oLed,rst);
input iClk;
input rst;
output [3:0] oLed;
reg [3:0] oLed;
reg [1:0] count;
reg [1:0] state;
wire clk;
always @(posedge iClk or negedge rst)
begin
if(!rst)
count = 0;
else
count = count+1;
end
//assign clk=count[1];
always @(posedge iClk or negedge rst)
begin
if(!rst)
oLed <=4'b0000;
else
begin
case(count)
2'b00: oLed<=4'b0001;
2'b01: oLed<=4'b0010;
2'b10: oLed<=4'b0100;
2'b11: oLed<=4'b1000;
endcase
//state=state+1;
end
end
endmodule
test_testshixu.v
`timescale 1ns / 1ps
////////////////////////////////////////////////////////////////////////////////
// Company:
// Engineer:
//
// Create Date: 12:00:03 05/06/2017
// Design Name: testshixu
// Module Name: D:/ise147/prj/testshixu/test.v
// Project Name: testshixu
// Target Device:
// Tool versions:
// Description:
//
// Verilog Test Fixture created by ISE for module: testshixu
//
// Dependencies:
//
// Revision:
// Revision 0.01 - File Created
// Additional Comments:
//
////////////////////////////////////////////////////////////////////////////////
module test;
// Inputs
reg iClk;
reg rst;
// Outputs
wire [3:0] oLed;
//reg [1:0] state;
// Instantiate the Unit Under Test (UUT)
testshixu uut (
.iClk(iClk),
.oLed(oLed),
.rst(rst)
);
initial
begin
iClk = 1'b0;
rst = 1'b0;
#5
iClk = 1'b1;
rst = 1'b1;
end
always #10
iClk = ~iClk;
endmodule
相关文章推荐
- ALTERA DE2 之 verilog HDL 学习笔记02 - 数码管
- VerilogHDL(1)数字集成电路设计方法概述
- 关于Verilog HDL的一些技巧、易错、易忘点(不定期更新)
- VerilogHDL可综合设计的注意事项
- (原創) Verilog入門書推薦3:基于Verilog HDL的數字系統應用設計 (SOC) (Verilog)
- 【连载】【FPGA黑金开发板】Verilog HDL那些事儿--低级建模 仿顺序操作(十二)
- [转载].Tips to Optimize your Verilog HDL code
- 【连载】【FPGA黑金开发板】Verilog HDL那些事儿--串口发送|接收 封装(十九)
- 【黑金动力社区】【FPGA黑金开发板】Verilog HDL的礼物 - Verilog HDL扫盲文
- 【连载】 FPGA Verilog HDL 系列实例--------直流电机PWM控制
- Verilog的私私细语 - Verilog HDL那些事儿-整合篇 第三章 理想时序的整合
- Verilog HDL 测量输入信号的正、负脉宽
- Verilog HDL Syntax And Semantics
- Art of Writing TestBenches (of Verilog HDL) Part - I
- FPGA Verilog HDL 系列实例--------半加器与全加器
- Info (10281): Verilog HDL Declaration information at WriteData_Top.v(25): object "WriteData" differs
- quartus II 报错(Error (10839): Verilog HDL error at sdram_params.v(30): declaring global objects is a)
- verilog HDL 学习的要点
- SCCB协议Verilog HDL程序
- 单色VGA显示verilogHDL通用代码