Verilog Code
module kr(
input clock,reset,
output [7:0] A
);
reg [20:0] count;
reg [7:0] temp;
reg [3:0] c;
reg dir;
initial dir=1'b1;
parameter a=8'b00000001;
parameter b=8'b10000000;
always@(posedge clock)
begin
count<=count+1;
if(reset) begin
count<=0;
temp<=0;
temp<=temp+1;
c<=0;
end
else if(count==2097151) begin
if(dir)begin
c<=c+1;
temp<=a<<c;
if(c==7) begin
dir<=1'b0;
c<=0; end
end
else begin
c<=c+1;
temp<=b>>c;
if(c==7) begin
dir<=1'b1;
c<=0; end
end
end
end
assign A=temp;
endmodule
.ucf File
NET "clock" LOC = B8;
NET "reset" LOC = A7;
NET "A[0]" LOC = M5;
NET "A[1]" LOC = M11;
NET "A[2]" LOC = P7;
NET "A[3]" LOC = P6;
NET "A[4]" LOC = N5;
NET "A[5]" LOC = N4;
NET "A[6]" LOC = P4;
NET "A[7]" LOC = G1;
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHi Im a beginner
ReplyDeletecan you explain your codes?