tablet counter system design
HERE I ATTACHED THE 2 DIGIT BCD COUNTER TESTBENCH .CAN SOMEONE HELP ME SEE WHETHER GOT ERROR OR NOT ?
[B][FONT=Times New Roman]module tb_two_digits_bcd_counter[/FONT] [FONT=Times New Roman]#(parameter REPEAT_TIME = 100)[/FONT] [FONT=Times New Roman]();[/FONT] [FONT=Times New Roman]//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/FONT] [FONT=Times New Roman]//Ouput declartion[/FONT] [FONT=Times New Roman]wire [7:0] tb_w_op_counter;[/FONT] [FONT=Times New Roman]wire tb_w_op_synch_tablet;[/FONT] [FONT=Times New Roman]wire tb_w_op_synch_bottle;[/FONT] [FONT=Times New Roman]//Input declartion[/FONT] [FONT=Times New Roman]reg tb_r_ip_count_restart;[/FONT] [FONT=Times New Roman]reg tb_r_ip_tablet_in;[/FONT] [FONT=Times New Roman]reg tb_r_ip_bottle_in;[/FONT] [FONT=Times New Roman]//Wire and register require[/FONT] [FONT=Times New Roman]reg tb_r_clk;[/FONT] [FONT=Times New Roman]reg tb_r_sys_reset;[/FONT] [FONT=Times New Roman]integer delay=25;[/FONT] [FONT=Times New Roman]wire tb_w_op_edge_tablet;[/FONT] [FONT=Times New Roman]//***********************************************************************[/FONT] [FONT=Times New Roman]//Module instantation[/FONT] [FONT=Times New Roman]//***********************************************************************[/FONT] [FONT=Times New Roman]counter[/FONT] [FONT=Times New Roman]test_counter[/FONT] [FONT=Times New Roman](.op_counter(tb_w_op_counter),[/FONT] [FONT=Times New Roman] .ip_tablet_in(tb_w_op_edge_tablet),[/FONT] [FONT=Times New Roman] .ip_bottle_in(tb_w_op_synch_bottle),[/FONT] [FONT=Times New Roman] .ip_count_restart(tb_r_ip_count_restart),[/FONT] [FONT=Times New Roman] .clock(tb_r_clk),[/FONT] [FONT=Times New Roman] .sys_reset(tb_r_sys_reset));[/FONT] [FONT=Times New Roman]edge_detector_counter[/FONT] [FONT=Times New Roman]ip_edge[/FONT] [FONT=Times New Roman](.op_edge(tb_w_op_edge_tablet),[/FONT] [FONT=Times New Roman] .ip_edge(tb_w_op_synch_tablet),[/FONT] [FONT=Times New Roman] .clock(tb_r_clk),[/FONT] [FONT=Times New Roman] .sys_reset(tb_r_sys_reset));[/FONT] [FONT=Times New Roman]synchronizer_bcd[/FONT] [FONT=Times New Roman]synch[/FONT] [FONT=Times New Roman](.op_synch_tablet(tb_w_op_synch_tablet),[/FONT] [FONT=Times New Roman] .op_synch_bottle(tb_w_op_synch_bottle),[/FONT] [FONT=Times New Roman] .ip_asynch_tablet(tb_r_ip_tablet_in),[/FONT] [FONT=Times New Roman] .ip_asynch_bottle(tb_r_ip_bottle_in),[/FONT] [FONT=Times New Roman] .sys_clock(tb_r_clk),[/FONT] [FONT=Times New Roman] .sys_reset(tb_r_sys_reset));[/FONT] [FONT=Times New Roman]//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/FONT] [FONT=Times New Roman]//Clock generation[/FONT] [FONT=Times New Roman]initial tb_r_clk = 1'b0;[/FONT] [FONT=Times New Roman]always #5 tb_r_clk = ~tb_r_clk;[/FONT] [FONT=Times New Roman]//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/FONT] [FONT=Times New Roman]//Signals intialization[/FONT] [FONT=Times New Roman]//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/FONT] [FONT=Times New Roman]//Sim time=0[/FONT] [FONT=Times New Roman]initial begin[/FONT] [FONT=Times New Roman] tb_r_sys_reset = 1'b1;[/FONT] [FONT=Times New Roman] tb_r_ip_bottle_in = 1'b0;[/FONT] [FONT=Times New Roman] tb_r_ip_tablet_in = 1'b0;[/FONT] [FONT=Times New Roman] tb_r_ip_count_restart = 1'b0;[/FONT] [FONT=Times New Roman] #10 tb_r_sys_reset = 1'b0;[/FONT] [FONT=Times New Roman] #20 tb_r_ip_bottle_in = 1'b1;[/FONT] [FONT=Times New Roman]//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~[/FONT] [FONT=Times New Roman]//Test case: Bottle_in[/FONT] [FONT=Times New Roman]//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ [/FONT] [FONT=Times New Roman]@(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] t_test_bottle_in(1,0); //Bottle detect no reset[/FONT] [FONT=Times New Roman]@(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] t_test_bottle_in(1,0); //Bottle detect no reset[/FONT] [FONT=Times New Roman]@(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] t_test_bottle_in(1,1); //Bottle detect ,count reset[/FONT] [FONT=Times New Roman]@(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] t_test_bottle_in(0,1); //Bottle no detect ,count reset[/FONT] [FONT=Times New Roman]repeat(10) @(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] $stop; [/FONT] [FONT=Times New Roman]end[/FONT] [FONT=Times New Roman]//***********************************************************************[/FONT] [FONT=Times New Roman]//Task repeat signal pattern[/FONT] [FONT=Times New Roman]//***********************************************************************[/FONT] [FONT=Times New Roman]//Task: test bottle in[/FONT] [FONT=Times New Roman]task t_test_bottle_in[/FONT] [FONT=Times New Roman](input reg tip_bottle,[/FONT] [FONT=Times New Roman] input reg tip_count_restart);[/FONT] [FONT=Times New Roman]begin[/FONT] [FONT=Times New Roman] repeat(REPEAT_TIME) begin@(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] tb_r_ip_bottle_in = tip_bottle;[/FONT] [FONT=Times New Roman] #100 tb_r_ip_count_restart = tip_count_restart;[/FONT] [FONT=Times New Roman] repeat(3) begin @(posedge tb_r_clk)[/FONT] [FONT=Times New Roman] tb_r_ip_tablet_in = 1'b1;[/FONT] [FONT=Times New Roman] delay = delay +5;[/FONT] [FONT=Times New Roman] #delay tb_r_ip_tablet_in = 1'b0;[/FONT] [FONT=Times New Roman] end[/FONT] [FONT=Times New Roman] delay = 25;[/FONT] [FONT=Times New Roman] end[/FONT] [FONT=Times New Roman]end[/FONT] [FONT=Times New Roman]endtask[/FONT] [FONT=Times New Roman]//************************************************************************[/FONT] [FONT=Times New Roman]endmodule[/FONT][/B]
Replies
You are reading an archived discussion.
Related Posts
anyone have idea where can i get high torque high speed motors? or maybe just high torque. 😕
Hi,
I am doing the project of water preheater for a thermal oil heater under my factory.
Could anyone kindly share with me how to calculate the heat transfer area...
Hi all,
Im looking for a low cost accelorometer or a peizo shock sensor specifically in the form of an IC that can be easily integrated into any a printed...
While formatting my system, I copied all my data from computer to pendrive(SANDISK) , my pen drive is not detecting. I tried it for more than 8 computers. But its...
I'm not sure whether you guys know about this. This is a neat gmail trick with which we can create multiple email accounts using the same email id. Use it...