`timescale 1ns / 1ns //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 17:53:57 11/22/2013 // Design Name: key2serie // Module Name: /home/leon/Dc2014/EI1060/PRACTICAS/pr_serie/key/tf_kb2serie.v // Project Name: S3demo // Target Device: // Tool versions: // Description: // // Verilog Test Fixture created by ISE for module: key2serie // // Dependencies: // // Revision: // Revision 0.01 - File Created // Additional Comments: // //////////////////////////////////////////////////////////////////////////////// module tf_kb2fifo; // Inputs reg CLK; reg RST; reg kd; reg kc; // Outputs wire [3:0] an; wire [6:0] ssg; reg [11:0] patrones [5:0]; reg [11:0] dato; wire txd; localparam CICLO=104000; // Instantiate the Unit Under Test (UUT) key2fifo uut ( .CLK(CLK), .RST(RST), .kd(kd), .kc(kc), .an(an), .ssg(ssg), .txd(txd) ); always begin #12 CLK=1;#8 CLK=0; end initial begin: TB integer i,j; $dumpfile("kb2fifo.vcd"); $dumpvars(0,tf_kb2fifo); // Initialize Inputs patrones[0]=11'b10111100000;//codigo F0 patrones[1]=11'b11000111000;//Tecla A codigo 1C patrones[2]=11'b10111100000;//codigo F0 patrones[3]=11'b11001100010;//Tecla N codigo 31 patrones[4]=11'b10111100000;//codigo F0 patrones[5]=11'b11000111000;//Tecla A codigo 1C RST = 1; kd = 0; kc = 0; // Wait 100 ns for global reset to finish #100; RST=0; #100; for (j=0;j<6;j=j+1) begin dato=patrones[j]; for (i=0;i<11;i=i+1) begin kc=1; #50 kd=dato[0]; #25 kc=0; #25 dato=dato >> 1; end end kc=1; //#1248000; #CICLO for(j=0;j<3;j=j+1) begin for (i=0;i<11;i=i+1) begin #CICLO $write("-%d-",txd); end #CICLO $write("\n"); end // La salida tiene ser parecido (puede tener otro orden o correspondencia //los segmenttos con los anodos: // an=4'b1100,ssg[6:0]=6'b1111001 - 1 // an=4'b1101,ssg[6:0]=6'b1111101 - C // an=4'b1011,ssg[6:0]=6'b0011001 - 4 // an=4'b0111,ssg[6:0]=6'b1111001 - 1 $stop(1); end endmodule