Question: Please write a testbench code that simulates pressing two random number buttons once each, as well as pressing the left and right shift buttons once
Please write a testbench code that simulates pressing two random number buttons once each, as well as pressing the left and right shift buttons once each.
module LCDcontrol Ierrst clk Icde Icdrs Icdrw Icddata, led, numberbtn controlbtn;
input rst clk:
input : numberbtn;
input : controlbtn;
wire : numberbtnt:
wire : controlbtnt:
oneshotuniversal #WTH Aclk rstnumberbtn: controlbtn:numberbtnt: controlbtnt:;
output Icde Icdrs Icdrw;
output reg : Icddata;
output reg : led;
wire Icde:
reg Icdrs Icdrw;
reg : cnt;
reg : state;
parameter DELAY b
FUNCTIONSET b
DISPONOFF b
ENTRYMODE b
SETADORESS b
DELAYT b
HRITE b
CURSOR b;
always @posedge clk or negedge rst
begin
ifrst begin
state DELAY;
led b;
end
else begin
casestate
DELAY: begin
ifcnt state FUNCTIONSET;
led b;
end
FUNCTIONSET : begin
ifcnt state DISPONOFF;
led b;
end
DISPONOFF : begin
ifcnt state ENTRYMODE;
led b;
end
ENTRYMODE : begin
ifcnt state SETADDRESS;
led b;
end
SETADORESS : begin
ifcnt state DELAYT;
led b;
end
DELAYT : begin
state numberbtnt HRITE : controlbtnt CURSOR : DELAYT;
led b;
end
WRITE : begin
ifcnt state DELAYT;
led b;
end
CURSOR : begin
ifcnt state DELAYT;
led b;
end
endcase
end
end
always @posedge clk or negedge rst
begin
ifrst
cnt b;
else
begin
casestate
DELAY :
ifcnt cnt ;
else cnt cnt ;
FUNCTIONSET :
ifcnt cnt ;
else cnt cnt ;
DISPONOFF :
ifcnt cnt ;
else cnt cnt ;
ENTRYMODE :
ifcnt cnt ;
else cnt cnt ;
SETADORESS :
ifcnt cnt ;
else cnt cnt ;
DELAYT :
cnt ;
mRITE:
ifcnt cnt ;
else cnt cnt ;
CURSOR :
ifcnt cnt ;
else cnt cnt ;
endcase
end
end
always @posedge clk or negedge rst
begin
iflrst
cdrs Icdrw Icddatab;
else
begin
casestate
FUNCTIONSET :
Icdrs Icdrw Icddatab;
DISPONOFF :
cdrs Icdrw Icddatab;
ENTRYMODE :
Icdrs Icdrw Icddatab;
SETADORESS :
Icdrs Icdrw Icddatab;
DELAYT :
Icdrs Icdrw Icddatab;
HRITE: begin
ifcnt cov begin
casenunberbin
b : lcdrs lodrw Icddatal s;
b : lcdrs lodrw Isddatab;
bicdirs Icdr lcddata ce b:
b ;icdrs Ecdri# lcddatab;
b : Itdrscdr Icddata
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
