-
Notifications
You must be signed in to change notification settings - Fork 0
/
decoder3to8.v
66 lines (51 loc) · 1.3 KB
/
decoder3to8.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
/*-- *******************************************************
-- Computer Architecture Course, Laboratory Sources
-- Amirkabir University of Technology (Tehran Polytechnic)
-- Department of Computer Engineering (CE-AUT)
-- https://ce[dot]aut[dot]ac[dot]ir
-- *******************************************************
-- All Rights reserved (C) 2021-2022
-- *******************************************************
-- Student ID :
-- Student Name:
-- Student Mail:
-- *******************************************************
-- Additional Comments:
--
--*/
/*-----------------------------------------------------------
--- Module Name: decrypt
-----------------------------------------------------------*/
module decrypt(
exit,
token,
pattern,
park_number);
input exit;
input [2:0] token;
input [2:0] pattern;
output [2:0] park_number;
always @( posedge exit)
begin
xor3bit x1(token , pattern , park_number);
end
endmodule
module xor3bit(in1,in2,out);
input [2:0] in1;
input [2:0] in2;
output [2:0] out;
xor1bit bit0(in1[0],in2[0],out[0]);
xor1bit bit1(in1[1],in2[1],out[1]);
xor1bit bit1(in1[1],in2[1],out[1]);
endmodule
module xor1bit(in1,in2,out);
input in1;
input in2;
output reg out;
if(in1 == 1 & in2 == 1)
out = 1'b0;
else if(in1 == 0 & in2 == 0)
out = 1'b0;
else
out = 1'b1;
endmodule