-
Notifications
You must be signed in to change notification settings - Fork 1
/
bus_slave_mux.v
100 lines (100 loc) · 2.06 KB
/
bus_slave_mux.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
/*
-- =====================================================================
FILE : bus_slave_mux.v
-- =====================================================================
*/
/*******General Headfile*******/
`include "global_config.h"
`include "nettype.h"
`include "stddef.h"
/******* Bus Headfile*******/
`include "bus.h"
module bus_slave_mux(
/******* Slave chip selection *******/
input wire s0_cs_,
input wire s1_cs_,
input wire s2_cs_,
input wire s3_cs_,
input wire s4_cs_,
input wire s5_cs_,
input wire s6_cs_,
input wire s7_cs_,
/******* Slave input signal *******/
//slave 0
input wire[`WordDataBus] s0_rd_data,
input wire s0_rdy_,
//slave 1
input wire[`WordDataBus] s1_rd_data,
input wire s1_rdy_,
//slave 2
input wire[`WordDataBus] s2_rd_data,
input wire s2_rdy_,
//slave 3
input wire[`WordDataBus] s3_rd_data,
input wire s3_rdy_,
//slave 4
input wire[`WordDataBus] s4_rd_data,
input wire s4_rdy_,
//slave 5
input wire[`WordDataBus] s5_rd_data,
input wire s5_rdy_,
//slave 6
input wire[`WordDataBus] s6_rd_data,
input wire s6_rdy_,
//slave 7
input wire[`WordDataBus] s7_rd_data,
input wire s7_rdy_,
/******* output signal *******/
output reg[`WordDataBus] m_rd_data,
output reg m_rdy_
);
/******* slave mux *******/
always@(*)
begin
if(s0_cs_ == `ENABLE_)
begin
m_rd_data = s0_rd_data;
m_rdy_ = s0_rdy_;
end
else if(s1_cs_ == `ENABLE_)
begin
m_rd_data = s1_rd_data;
m_rdy_ = s1_rdy_;
end
else if(s2_cs_ == `ENABLE_)
begin
m_rd_data = s2_rd_data;
m_rdy_ = s2_rdy_;
end
else if(s3_cs_ == `ENABLE_)
begin
m_rd_data = s3_rd_data;
m_rdy_ = s3_rdy_;
end
else if(s4_cs_ == `ENABLE_)
begin
m_rd_data = s4_rd_data;
m_rdy_ = s4_rdy_;
end
else if(s5_cs_ == `ENABLE_)
begin
m_rd_data = s5_rd_data;
m_rdy_ = s5_rdy_;
end
else if(s6_cs_ == `ENABLE_)
begin
m_rd_data = s6_rd_data;
m_rdy_ = s6_rdy_;
end
else if(s7_cs_ == `ENABLE_)
begin
m_rd_data = s7_rd_data;
m_rdy_ = s7_rdy_;
end
else
begin
m_rd_data = `WORD_DATA_W'h0;
m_rdy_ = `DISABLE_;
end
end
endmodule