⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 lcd_testbench.v

📁 基于MAXII CPLD的对1602字符型液晶进行读写操作
💻 V
字号:
/****************************************************************************************************************** TESTBENCH FOR LCD CONTROLER* JANUARY 2007*****************************************************************************************************************/`timescale 1 us / 1 usmodule lcd_testbench; reg rst,we;             // rst is active low asynchronous reset                        // we is to be made 1 when writing data into lcdreg [7:0] data;         // data lines from processor to LCD controllerreg [7:0] count;        // count is a register used to count the number of pulses on Ewire clk_w,ack,RW,RS,E;  wire [7:0] DB;/* Instantiation of the module under test */lcd_controller lcd_final(.clk_w(clk_w),.rst(rst),.we(we),.ack(ack),.data(data),.DB(DB),.RW(RW),.RS(RS),.E(E));initial begin    rst = 0;                // Reset asserted    we = 1;                 // Write enable disasserted    data = 8'b00000000;         count = 8'b00000000;    // Count initialised to zeroendalwaysbegin   #500   rst =1;                     // Reset disasserted   while(count <= 8'b00001001) // Loop to count the number of pulses on E and wait till 8 pulses have been generated   begin       @(negedge E)       count = count + 8'b00000001;   end   $display("Initialisation Complete %d", $time);    count = 8'b00000000;       // Reinitialise count to zero   @(negedge ack);            // Wait till acknowledge signal has been asserted   $display("Default message has been displayed on LCD %d", $time);     data = 8'b10011001;        // Data to be written into LCD   we = 0;                    // Assert write enable   @(negedge E);              // Wait for negative edge on E to latch data into LCD   # 233   $display("Since it is not possible to read busy flag in the testbench(due to absence of LCD), we are waiting for 233 us and assuming that in this time, busy flag would have gone low.Data has been written into LCD %d", $time);       #500   rst = 0;                    // Assert reset   #500   rst = 1;                    // Disassert reset   while(count <= 8'b00001001) // Again wait for 8 negative edges on E   begin       @(negedge E)       count = count + 8'b00000001;   end   $display("Initialisaton done again %d", $time);   $display (" PASS: Checked for initialisation, display of the default message and the character whose ASCII equivalent is sent to the LCD %d", $time);     $stop;   end      endmodule/***************************************** END OF TESTBENCH ****************************************************************************************************************************************************************************************/

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -