-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreflector.v
69 lines (66 loc) · 1.66 KB
/
reflector.v
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
// This is the reflector part of the enigma machine.
// It reflects one signal to another signal.
// Similar to a rotor but can't rotate.
module reflector(out, in);
output [4:0] out;
input [4:0] in;
reg [4:0] out;
always @(in)
begin
if (in == 5'd1) begin
out = 5'd14;
end else if (in == 5'd2) begin
out = 5'd15;
end else if (in == 5'd3) begin
out = 5'd16;
end else if (in == 5'd4) begin
out = 5'd17;
end else if (in == 5'd5) begin
out = 5'd18;
end else if (in == 5'd6) begin
out = 5'd19;
end else if (in == 5'd7) begin
out = 5'd20;
end else if (in == 5'd8) begin
out = 5'd21;
end else if (in == 5'd9) begin
out = 5'd22;
end else if (in == 5'd10) begin
out = 5'd23;
end else if (in == 5'd11) begin
out = 5'd24;
end else if (in == 5'd12) begin
out = 5'd25;
end else if (in == 5'd13) begin
out = 5'd26;
end else if (in == 5'd14) begin
out = 5'd1;
end else if (in == 5'd15) begin
out = 5'd2;
end else if (in == 5'd16) begin
out = 5'd3;
end else if (in == 5'd17) begin
out = 5'd4;
end else if (in == 5'd18) begin
out = 5'd5;
end else if (in == 5'd19) begin
out = 5'd6;
end else if (in == 5'd20) begin
out = 5'd7;
end else if (in == 5'd21) begin
out = 5'd8;
end else if (in == 5'd22) begin
out = 5'd9;
end else if (in == 5'd23) begin
out = 5'd10;
end else if (in == 5'd24) begin
out = 5'd11;
end else if (in == 5'd25) begin
out = 5'd12;
end else if (in == 5'd26) begin
out = 5'd13;
end else begin
out = 5'd0;
end
end
endmodule