`timescale 1ns / 1ns //////////////////////////////////////////////////////////////////////////////// // Company: // Engineer: // // Create Date: 13:09:18 11/22/2013 // Design Name: recepcion // Module Name: /home/leon/Dc2014/EI1060/PRACTICAS/pr_serie/key/tf_recepcion.v // Project Name: S3demo // Target Device: // Tool versions: // Description: // // Verilog Test Fixture created by ISE for module: recepcion // // Dependencies: // // Revision: // Revision 0.01 - File Created // Additional Comments: // //////////////////////////////////////////////////////////////////////////////// module tf_duplex; // Inputs reg rxd; wire txd; reg rst; reg reloj; // Outputs wire [6:0] ssg; wire [3:0] an; reg [9:0] dato; reg [6:0] segmentos [3:0]; localparam CICLO=104000,CIENCICLOS=100*CICLO,BITS=8,PARIDAD=0; reg start; always @(posedge(reloj)) begin: alm integer idx; idx=((an==7)?0:((an==11)?1:((an==13)?2:(an==14)?3:4))); segmentos[idx]=ssg; end // Instantiate the Unit Under Test (UUT) serie2fullduplex uut ( .ssg(ssg), .an(an), .rxd(rxd), .txd(txd), .send(start), .rst(rst), .reloj(reloj) ); always begin #6 reloj=1;#4 reloj=0; end initial begin: TB integer i; $dumpfile("recepcion.vcd"); $dumpvars(0,tf_duplex); //dato=11'b11100100110;//dato es C9 1(bits de stop) 1 (1 bit de paridad) 8(Datos C9) 0(start) dato=10'b1110010010;//dato es C9 1(bits de stop) 8(Datos C9) 0(start) // Initialize Inputs rxd = 1; rst = 1; // Wait 100 ns for global reset to finish #100; rst=0; #CICLO; for (i=0;i<(BITS+PARIDAD+1);i=i+1) begin rxd=dato[0]; dato=dato >>1; start=0; #CICLO; end start=1; for (i=0;i<(BITS+PARIDAD+1);i=i+1) begin #CICLO; $write("%d-",txd); end; start=0; $write (" \n"); #CIENCICLOS; $write ("SEG %b-AN %h \n",segmentos[3],4'h3); $write ("SEG %b-AN %h \n",segmentos[2],4'h2); $write ("SEG %b-AN %h \n",segmentos[1],4'h1); $write ("SEG %b-AN %h \n",segmentos[0],4'h0); #50 $stop(1); end // La salida tiene ser parecido (puede tener otro orden o correspondencia //los segmenttos con los anodos: //SEG 0010000-AN 3 9 //SEG 1000110-AN 2 C //SEG 1111111-AN 1 //SEG 1111111-AN 0 endmodule