-
Notifications
You must be signed in to change notification settings - Fork 0
/
SmartHomeSystem.v
128 lines (115 loc) · 2.99 KB
/
SmartHomeSystem.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/*-- *******************************************************
-- 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) 2019-2020
-- *******************************************************
-- Student ID : 9831074
-- Student Name: Leili Barekatain
-- Student Mail:
-- *******************************************************
-- Additional Comments:
--
--*/
/*-----------------------------------------------------------
--- Module Name: Smart Home System
--- Description: ModuleSmartHomeSystem:
-----------------------------------------------------------*/
`timescale 1 ns/1 ns
module SmartHomeSystem (
input arst , // async reset
input clk , // clock posedge
input request,
input confirm,
input gds_din , // gas detector input
output [2:0 ] gds_dout , // gas detector output
input [ 1:0] password,
input [34:0] confdata,
input [31:0] tc_base,
input [15:0] adc_data,
output [31:0] tempc,
input [ 7:0] speed,
output [ 3:0] chs_power,
output chs_mode,
output pwm_data,
input [ 3:0] tcode,
output [ 3:0] wshade,
output [ 3:0] lightnum,
output [15:0] lightstate,
input dance_load,
output [ 7:0] dance_qdata,
output [ 2:0] dbg_state
);
wire [ 7:0] tc_ref;
wire [ 7:0] chs_conf;
wire [ 3:0] ulight;
wire [ 3:0] lenght;
wire [ 7:0] dance_pdata;
wire dance_din;
wire mem_wren;
wire [34:0] mem_in;
wire [34:0] mem_out;
wire [ 1:0] syskey;
assign tc_ref = mem_out[7:0];
assign chs_conf = mem_out[15:8];
assign lenght = mem_out[23:20];
assign ulight = mem_out[19:16];
assign dance_din = mem_out[32];
assign dance_pdata = mem_out[31:24];
assign syskey = mem_out[34:33] ;
TemperatureCalculator Module1 (
.tc_base (tc_base ),
.tc_ref (tc_ref ),
.adc_data(adc_data),
.tempc (tempc )
);
GasDetectorSensor Module2 (
.arst(arst),
.clk(clk),
.din(gds_din),
.dout(gds_dout));
CoolHeatSystem Module3 (
.arst (arst ),
.clk (clk ),
.speed (speed ),
.chs_conf (chs_conf ),
.chs_power(chs_power),
.chs_mode (chs_mode ),
.pwm_data (pwm_data )
);
LightingSystem Module4 (
.tcode (tcode ),
.ulight (ulight ),
.lenght (lenght ),
.wshade (wshade ),
.lightnum (lightnum ),
.lightstate(lightstate)
);
LightDance Module5 (
.arst(arst),
.clk(clk),
.din(dance_din),
.load(dance_load),
.pdata(dance_pdata),
.qdata(dance_qdata));
MemoryUnit Module6 (
.arst(arst),
.clk(clk),
.wren(mem_wren),
.din(mem_in),
.dout(mem_out));
ControlUnit Module7 (
.arst (arst ),
.clk (clk ),
.request (request ),
.confirm (confirm ),
.password (password ),
.syskey (syskey ),
.configin (confdata ),
.configout(mem_in ),
.write_en (mem_wren ),
.dbg_state(dbg_state)
);
endmodule