Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- module zad5(
- input CLOCK_50,
- input [2:0] SW,
- input [1:0] KEY,
- output [0:0] LEDR);
- wire clk;
- integer iterator = 0;
- wire [0:12] symbolStruct;
- counter_to_make_delay_0_5sek(CLOCK_50,1,clk);
- morse_symbols(SW,symbolStruct);
- reg dioda;
- reg [0:12] symbol;
- assign LEDR[0] = dioda;
- always@(posedge clk, negedge KEY[0])
- begin
- if(~KEY[0])
- begin
- dioda<=0;
- iterator=0;
- end
- else if(KEY[1])
- begin
- dioda<=symbolStruct[iterator];
- iterator=iterator+1;
- end
- end
- endmodule
- module counter_to_make_delay_0_5sek(
- input clk, aclr,
- output reg clockTact);
- reg [25:0] i;
- always@(posedge clk, negedge aclr)
- if(!aclr)
- begin
- i<=0;
- clockTact<=0;
- end
- else
- begin
- if(i==2)
- begin
- i<=0;
- clockTact<=1;
- end
- else
- begin
- i<=i+1;
- clockTact<=0;
- end
- end
- endmodule
- module morse_symbols(
- input [2:0] in,
- output reg [0:12] out);
- always@(*)
- case(in)
- 3'b000: out=13'b0101110000000;
- 3'b001: out=13'b0111010101000;
- 3'b010: out=13'b0111010111010;
- 3'b011: out=13'b0111010100000;
- 3'b100: out=13'b0100000000000;
- 3'b101: out=13'b0101011101000;
- 3'b110: out=13'b1110111010000;
- 3'b111: out=13'b0101010100000;
- endcase
- endmodule
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement