質問編集履歴
4
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -18,7 +18,7 @@
|
|
18
18
|
|
19
19
|
### 発生している問題・エラーメッセージ
|
20
20
|
|
21
|
-
syntax error
|
21
|
+
syntax error
|
22
22
|
|
23
23
|
|
24
24
|
|
@@ -42,7 +42,7 @@
|
|
42
42
|
|
43
43
|
reg `WORD pc;
|
44
44
|
|
45
|
-
reg `WORD inst
|
45
|
+
reg `WORD inst;
|
46
46
|
|
47
47
|
|
48
48
|
|
@@ -50,13 +50,13 @@
|
|
50
50
|
|
51
51
|
|
52
52
|
|
53
|
-
re
|
53
|
+
wire `WORD r1;
|
54
54
|
|
55
|
-
re
|
55
|
+
wire `WORD r2;
|
56
56
|
|
57
57
|
|
58
58
|
|
59
|
-
|
59
|
+
decode d( inst, r1, r2 );
|
60
60
|
|
61
61
|
always @(posedge clock) begin
|
62
62
|
|
@@ -64,7 +64,7 @@
|
|
64
64
|
|
65
65
|
inst = instructions[pc];
|
66
66
|
|
67
|
-
|
67
|
+
|
68
68
|
|
69
69
|
|
70
70
|
|
@@ -75,6 +75,8 @@
|
|
75
75
|
$display("instuctions[pc] = %x\n", instructions[pc]);
|
76
76
|
|
77
77
|
end
|
78
|
+
|
79
|
+
|
78
80
|
|
79
81
|
|
80
82
|
|
@@ -100,15 +102,15 @@
|
|
100
102
|
|
101
103
|
module decode(inst, r1, r2);
|
102
104
|
|
103
|
-
input
|
105
|
+
input `WORD inst;
|
104
106
|
|
105
107
|
output [7:0] r1, r2;
|
106
108
|
|
107
109
|
|
108
110
|
|
109
|
-
|
111
|
+
r1 = inst[15:8];
|
110
112
|
|
111
|
-
|
113
|
+
r2 = inst[7:0];
|
112
114
|
|
113
115
|
endmodule
|
114
116
|
|
3
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -100,15 +100,15 @@
|
|
100
100
|
|
101
101
|
module decode(inst, r1, r2);
|
102
102
|
|
103
|
-
input inst;
|
103
|
+
input [15:0] inst;
|
104
104
|
|
105
|
-
output r1, r2;
|
105
|
+
output [7:0] r1, r2;
|
106
106
|
|
107
107
|
|
108
108
|
|
109
|
-
assign r
|
109
|
+
assign r1 = inst[15:8];
|
110
110
|
|
111
|
-
assign r
|
111
|
+
assign r2 = inst[7:0];
|
112
112
|
|
113
113
|
endmodule
|
114
114
|
|
2
質問追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -2,7 +2,17 @@
|
|
2
2
|
|
3
3
|
|
4
4
|
|
5
|
-
以下のベリログのコードでdecodeというmoduleをインスタンス化した時にエラーになるのですが何が原因なのでしょうか?
|
5
|
+
以下のベリログのコードでdecodeというmoduleをインスタンス化した時にエラーになるのですが何が原因なのでしょうか?
|
6
|
+
|
7
|
+
decodeモジュールでは`16bit`の`inst`を`r1`と`r2`に分けるという動作をしたいです
|
8
|
+
|
9
|
+
|
10
|
+
|
11
|
+
---
|
12
|
+
|
13
|
+
調べた所`always@`の中にモジュールのインスタンス化をするとエラーが起きるそうなので、alwaysの外に移動してみたのですが、今度は`Port 1 (inst) of decode expects 1 bits, got 16.`というエラーに遭遇しました。
|
14
|
+
|
15
|
+
|
6
16
|
|
7
17
|
|
8
18
|
|
1
コード修正
test
CHANGED
File without changes
|
test
CHANGED
@@ -54,7 +54,7 @@
|
|
54
54
|
|
55
55
|
inst = instructions[pc];
|
56
56
|
|
57
|
-
decode d( inst, r1, r2 );
|
57
|
+
decode d( inst, r1, r2 ); // ここでエラー発生
|
58
58
|
|
59
59
|
|
60
60
|
|