Если связать оператором assign "провода", но при этом ни один не подключить к внешнему входу или к выходу любого элемента или модуля внутри модуля, то среда не заведёт эти "провода" ни в один входящий пин любого элемента или модуля внутри модуля.
Это не удобно если генерировать внутри модуля цепь модулей, где в текущий заводится провод следующего по цепи генерации. Иначе говоря - если нам нужно на конкретном входе экземпляра получать сигнал от другого экземпляра, следующего за ним в процессе генерации, что делает невозможным приём с assign, то как лайфхак - делать дополнительный выход на каждом, и функцией assign связывать входящий и выходящий пин экземпляра (даже если это получается просто провод проходящий сквозь и не подключаемый ни к чему внутри), что является рабочим приёмом. А не имеющий входа провод - ни на один вход не подключается. Более подробно позднее.
Вот и позднее, как и обещал:
То-есть вот модуль с тоннелем, но этот тоннель у меня играет совсем другую роль, чем в традиционном проектировании - он позволяет мне синтезировать используя то, чего ещё не случилось для компилятора. Все другие уловки и трюки - компилятор отказывается выполнять (мне так понятно - что он не "понимает", хотя в принципе его можно заставить сделать даже то, чего он не "понимает".
Туннель в этом модуле
| Code | 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
| module MyC
(input Deactivat,StartTact, Set, ResLim, ResFil, Fillsin, limit, Run, Zero, Unit, InJamp, InFillsin, InStub1, InFStub, InFStub1, Sel, Sel2,
output Finish, OutJamp, OutFillsin, OutStub1, OutFStub, OutFStub1, MemoriOut, Se2);
wire sig0;
bufif1 bf0(InFillsin, Fillsin, Sel);
Trs trs0(InFillsin, ResFil, trs0_0);
and a0(f1_0, Sel, limit);
Trs trs1(f1_0, ResLim, OutFStub);
not n0(OutFStub1, OutFStub);
xor x0(x0_0, OutFStub1, Sel2);
bufif1 bf1(InFillsin, InFStub1, InFStub);
bufif1 bf2(OutFillsin, InFillsin, x0_0);
and an0(an0_0, trs0_0, Unit);
and an1(an1_0, trs0_0, Zero);
Trs trs2(an0_0, an1_0, trs2_0);
and an2(an2_0, sig0, trs2_0);
and an3(an3_0, InJamp, an2_0);
and an4(MemoriOut, an3_0, StartTact);
and an5(an5_0, Sel, Run);
bufif1 bf3(InJamp, an5_0, an5_0);
bufif1 bf4_(Deact, MemoriOut, Deactivat);
Trs trs3(Set, Deact, sig0);
xor x1(x1_0, trs2_0, sig0);
bufif1 bf4(InJamp, InStub1, InStub1);
and an6(an6_0, x1_0, x0_0);
not n1(OutStub1, x1_0);
bufif1 bf5(OutJamp, InJamp, an6_0);
and an7(Finish, MemoriOut, OutFStub);
assign Se2 = Sel;
endmodule |
|
в предпоследней строке.
А вот модуль с блоком генерации, все другие варианты - проверил, компилятор отказывается выполнять другие трюки, чтобы сделать то, чего он ещё не видел, а такой вот тоннель
- позволяет ему исполнить.
| Code | 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
| module Mych(input clk, output wire led0,led1, led2,led3,led4,led5);
wire [0:0]se[0:6];
wire [0:0]se2[0:6];
wire [0:0]ActivMemo[0:5];
wire Start0,Start, Start1, Set, Fillsin1, EndFillsin, StartTact1;
wire Finish, FinishTact, Unit,InJamp, StartTact,Deactivation;
wire sens, led;
wire limit0;
genvar i;
generate
wire [0:2]OtJam, OutFillsi[0:5], OutStu1[0:5], OutFStu[0:5], OutFStu1[0:5], ORi[0:5], Fini[0:5];
MyCF mycf(Deactivation,StartTact, Set, ResLim, ResFil, Fillsin1, limit0, Run, Zero, Unit,InJamp,,,,
,Fillsin1,se2[0],Fini[0],ORi[0], OutFillsi[0], OutStu1[0], OutFStu[0], OutFStu1[0], ActivMemo[0]);
bufif1 bf0(FinishTact, ActivMemo[0], ActivMemo[0]);
bufif1 bf1(Finish, Fini[0], Fini[0]);
for (i=0; i<5; i=i+1 ) begin:MyC_generation
//assign se2[i]=se[i];
MyC myc(Deactivation,StartTact, Set, ResLim, ResFil, Fillsin, limit0, Run, Zero, Unit, ORi[i], OutFillsi[i], OutStu1[i], OutFStu[i], OutFStu1[i]
,se[i],se2[i+1], Fini[i+1],ORi[i+1], OutFillsi[i+1], OutStu1[i+1], OutFStu[i+1], OutFStu1[i+1], ActivMemo[i+1], se2[i]);
bufif1 bf0(FinishTact, ActivMemo[i+1], ActivMemo[i+1]);
bufif1 bf1(Finish, Fini[i+1], Fini[i+1]);
end
endgenerate
Lancher Lanch_01();
assign led0 = ActivMemo [0];
assign led1 = ActivMemo [1];
assign led2 = ActivMemo [2];
assign led3 = ActivMemo [3];
assign led4 = ActivMemo [4];
assign led5 = ActivMemo [5];
endmodule |
|
Если кому интересно - остальные модули:
Кликните здесь для просмотра всего текста
| Code | 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
129
130
131
132
133
134
135
136
137
138
139
140
141
| module Trs
(input S, R, output Q);
xor xor_01 (G,S,R);
DLC dlc_01 (Q,S,G,R);
endmodule
module MyCF
(input Deactivat,StartTact, Set, ResLim, ResFil, Fillsin, limit, Run, Zero, Unit, InJamp, InFillsin, InStub1, InFStub, InFStub1, Sel, Sel2,
output Finish, OutJamp, OutFillsin, OutStub1, OutFStub, OutFStub1, MemoriOut);
wire sig0;
bufif1 bf0(InFillsin, Fillsin, Sel);
Trs trs0(InFillsin, ResFil, trs0_0);
and a0(f1_0, Sel, limit);
Trs trs1(f1_0, ResLim, OutFStub);
not n0(OutFStub1, OutFStub);
xor x0(x0_0, OutFStub1, Sel2);
//bufif1 bf1(InFillsin, InFStub1, InFStub);
bufif1 bf2(OutFillsin, InFillsin, x0_0);
and an0(an0_0, trs0_0, Unit);
and an1(an1_0, trs0_0, Zero);
Trs trs2(an0_0, an1_0, trs2_0);
and an2(an2_0, sig0, trs2_0);
and an3(an3_0, InJamp, an2_0);
and an4(MemoriOut, an3_0, StartTact);
and an5(an5_0, Sel, Run);
bufif1 bf3(InJamp, an5_0, an5_0);
bufif1 bf4(Deact, MemoriOut, Deactivat);
Trs trs3(Set, Deact, sig0);
xor x1(x1_0, trs2_0, sig0);
//bufif1 bf4(InJamp, InStub1, InStub1);
and an6(an6_0, x1_0, x0_0);
not n1(OutStub1, an6_0);
bufif1 bf5(OutJamp, InJamp, an6_0);
and an7(Finish, MemoriOut, OutFStub);
endmodule
module MyC
(input Deactivat,StartTact, Set, ResLim, ResFil, Fillsin, limit, Run, Zero, Unit, InJamp, InFillsin, InStub1, InFStub, InFStub1, Sel, Sel2,
output Finish, OutJamp, OutFillsin, OutStub1, OutFStub, OutFStub1, MemoriOut, Se2);
wire sig0;
bufif1 bf0(InFillsin, Fillsin, Sel);
Trs trs0(InFillsin, ResFil, trs0_0);
and a0(f1_0, Sel, limit);
Trs trs1(f1_0, ResLim, OutFStub);
not n0(OutFStub1, OutFStub);
xor x0(x0_0, OutFStub1, Sel2);
bufif1 bf1(InFillsin, InFStub1, InFStub);
bufif1 bf2(OutFillsin, InFillsin, x0_0);
and an0(an0_0, trs0_0, Unit);
and an1(an1_0, trs0_0, Zero);
Trs trs2(an0_0, an1_0, trs2_0);
and an2(an2_0, sig0, trs2_0);
and an3(an3_0, InJamp, an2_0);
and an4(MemoriOut, an3_0, StartTact);
and an5(an5_0, Sel, Run);
bufif1 bf3(InJamp, an5_0, an5_0);
bufif1 bf4_(Deact, MemoriOut, Deactivat);
Trs trs3(Set, Deact, sig0);
xor x1(x1_0, trs2_0, sig0);
bufif1 bf4(InJamp, InStub1, InStub1);
and an6(an6_0, x1_0, x0_0);
not n1(OutStub1, x1_0);
bufif1 bf5(OutJamp, InJamp, an6_0);
and an7(Finish, MemoriOut, OutFStub);
assign Se2 = Sel;
endmodule
module Smalch (input mset, mreset, output mquit);
Trs Deff_01(mquit,mreset,Out1);
Trs Deff_02(Out1,mreset,Out2);
Trs Deff_03(Out2,,Out3);
not not_01(mquit, Out3);
endmodule
module Smalch1 (input mset, mreset, output mquit, rquit);
Trs Deff_01(mset,mreset,Out1);
Trs Deff_02(Out1,mreset,rquit);
Trs Deff_03(rquit,mreset,mquit);
endmodule
module Lancher (input off, output limit,fillsin,unit);
wire Off_01, Off_02, Off_03, Off_04;
Smalch smch1(,Off_01,limit);
Smalch1 smch2(limit,Off_02,fillsin,Off_01);
Smalch1 smch3(fillsin, off,unit,Off_02);
endmodule
//module MyCount
//(input clk, sens, output ld);
//reg [25:0] count =1;
//reg led_reg = 0;
//assign ld = led_reg;
//wire sens1;
//assign sens1 = sens;
//always @ (posedge clk)
//begin
//if (sens1 == 1) begin
//led_reg = 0;
// count = count +1;
//if (count == 50000000) begin
//count <= 1;
//led_reg = 1;
//end
//end
//end
//endmodule
module Mych(input clk, output wire led0,led1, led2,led3,led4,led5);
wire [0:0]se[0:6];
wire [0:0]se2[0:6];
wire [0:0]ActivMemo[0:5];
wire Start0,Start, Start1, Set, Fillsin1, EndFillsin, StartTact1;
wire Finish, FinishTact, Unit,InJamp, StartTact,Deactivation;
wire sens, led;
wire limit0;
genvar i;
generate
wire [0:2]OtJam, OutFillsi[0:5], OutStu1[0:5], OutFStu[0:5], OutFStu1[0:5], ORi[0:5], Fini[0:5];
MyCF mycf(Deactivation,StartTact, Set, ResLim, ResFil, Fillsin1, limit0, Run, Zero, Unit,InJamp,,,,
,Fillsin1,se2[0],Fini[0],ORi[0], OutFillsi[0], OutStu1[0], OutFStu[0], OutFStu1[0], ActivMemo[0]);
bufif1 bf0(FinishTact, ActivMemo[0], ActivMemo[0]);
bufif1 bf1(Finish, Fini[0], Fini[0]);
for (i=0; i<5; i=i+1 ) begin:MyC_generation
//assign se2[i]=se[i];
MyC myc(Deactivation,StartTact, Set, ResLim, ResFil, Fillsin, limit0, Run, Zero, Unit, ORi[i], OutFillsi[i], OutStu1[i], OutFStu[i], OutFStu1[i]
,se[i],se2[i+1], Fini[i+1],ORi[i+1], OutFillsi[i+1], OutStu1[i+1], OutFStu[i+1], OutFStu1[i+1], ActivMemo[i+1], se2[i]);
bufif1 bf0(FinishTact, ActivMemo[i+1], ActivMemo[i+1]);
bufif1 bf1(Finish, Fini[i+1], Fini[i+1]);
end
endgenerate
Lancher Lanch_01();
assign led0 = ActivMemo [0];
assign led1 = ActivMemo [1];
assign led2 = ActivMemo [2];
assign led3 = ActivMemo [3];
assign led4 = ActivMemo [4];
assign led5 = ActivMemo [5];
endmodule |
|
|