-
Notifications
You must be signed in to change notification settings - Fork 1
/
pe_instr_decoder.v
72 lines (63 loc) · 1022 Bytes
/
pe_instr_decoder.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
//
// Copyright (C) 2005 Uday Bondhugula
// Copyright (C) 2005 Ananth Devulapalli
//
// Please see the LICENSE file for details.
//
// Decodes the instruction and gives a command to the PE.
//
`include "params.v"
module pe_instr_decoder(
instr_in,
command,
);
parameter my_id = `logB'b0;
input [`INSTR_WIDTH-1: 0] instr_in;
output [`OP_WIDTH-1: 0] command;
reg [`OP_WIDTH-1: 0] command;
wire [`OP_WIDTH-1: 0] op;
wire [`logB-1: 0] id;
assign id = instr_in[`INSTR_WIDTH-2: `OP_WIDTH];
assign op = instr_in[`OP_WIDTH-1:0];
assign fwd = instr_in[`INSTR_WIDTH-1];
always @(*)
begin
if (my_id < id)
begin
case (op)
`READ0:
begin
command <= `FORWARD;
end
`READ1:
begin
command <= `FORWARD;
end
`COMPUTE:
begin
command <= `COMPUTE;
end
default:
begin
command <= `FORWARD;
end
endcase
end
else
if (my_id == id)
begin
command <= op;
end
else
begin
if (op == `COMPUTE)
begin
command <= `COMPUTE;
end
else
begin
command <= `IDLE;
end
end
end
endmodule