Академический Документы
Профессиональный Документы
Культура Документы
v"
module Main(
input [3:0] dataplayer1,
input [3:0] dataplayer2,
input guardar,
input intentop1,
input intentop2,
//input selector,
input reset,
output [6:0] display1player1,
output [6:0] display2player1,
output [6:0] display1player2,
output [6:0] display2player2,
output reg[1:0] ledp1,
output reg[1:0] ledp2
);
for(k=0;k<=3;k=k+1)
begin
memoriaplayer1[k]=0;
memoriaplayer2[k]=0;
end
i=0;
j=0;
$display("CONTADOR %d",contador);
end
end
always@(intentop1)
begin
if (selector==1)
begin
if (intentop1==1 && i<=4)
begin
if (dataplayer1==memoriaplayer2[i])
begin
pulso_bienp1=pulso_bienp1+1;
pulso_errorp1=0;
i=i+1;
end
else
pulso_errorp1=pulso_errorp1+1;
end
end
if (pulso_bienp1==4)
begin
ledp1=2'b01;
i=i;
end
else if (pulso_errorp1==4)
begin
ledp1=2'b10;
i=i;
end;
end
always@(intentop2)
if (selector==1)
begin
begin
if (intentop2==1 && j<=4)
begin
if (dataplayer2==memoriaplayer1[j])
begin
pulso_bienp2=pulso_bienp2+1;
pulso_errorp2=0;
j=j+1;
end
else
pulso_errorp2=pulso_errorp2+1;
end
end
if (pulso_bienp2==4)
begin
ledp2=2'b01;
j=j;
end
else if (pulso_errorp2==4)
begin
ledp2=2'b10;
j=j;
end
end
begin
memoria[i]=0;
$display(memoria[i]);
end
end
else if (save==0 && read==1 && reset==0)
begin
case (localidad)
0 : out=0;
1 : out=memoria[localidad];
2 : out=memoria[localidad];
3 : out=memoria[localidad];
4 : out=memoria[localidad];
5 : out=memoria[localidad];
6 : out=memoria[localidad];
7 : out=memoria[localidad];
default:out=0;
endcase
end
else
out =0;
end*/
endmodule