File tree Expand file tree Collapse file tree 6 files changed +172
-0
lines changed Expand file tree Collapse file tree 6 files changed +172
-0
lines changed Original file line number Diff line number Diff line change 11PYTHON =python3
22# OPT=-m pdb
3+ # OPT=-m cProfile -s time
4+ # OPT=-m cProfile -o profile.rslt
35
46CODEGEN =codegen.py
57SRCS =../testcode/test.v
Original file line number Diff line number Diff line change 11PYTHON =python3
22# PYTHON=python2.7
33# OPT=-m pdb
4+ # OPT=-m cProfile -s time
5+ # OPT=-m cProfile -o profile.rslt
46
57ANALYZER =controlflow_analyzer.py
68ACTIVE =active_analyzer.py
Original file line number Diff line number Diff line change @@ -2,6 +2,8 @@ PYTHON=python3
22# PYTHON=python2.7
33PYTHON27 =python2.7
44# OPT=-m pdb
5+ # OPT=-m cProfile -s time
6+ # OPT=-m cProfile -o profile.rslt
57
68ANALYZER =dataflow_analyzer.py
79MERGE =merge.py
Original file line number Diff line number Diff line change 1+ module TOP (CLK, RST, LED);
2+ input CLK, RST;
3+ output [7 :0 ] LED;
4+ reg [31 :0 ] cnt;
5+ always @(posedge CLK) begin
6+ if (RST) begin
7+ cnt <= 0 ;
8+ end else begin
9+
10+ case (cnt)
11+
12+ 0 : begin
13+ cnt <= 0 + 1 ;
14+ end
15+ 1 : begin
16+ cnt <= 1 + 1 ;
17+ end
18+ 2 : begin
19+ cnt <= 2 + 1 ;
20+ end
21+ 3 : begin
22+ cnt <= 3 + 1 ;
23+ end
24+ 4 : begin
25+ cnt <= 4 + 1 ;
26+ end
27+ 5 : begin
28+ cnt <= 5 + 1 ;
29+ end
30+ 6 : begin
31+ cnt <= 6 + 1 ;
32+ end
33+ 7 : begin
34+ cnt <= 7 + 1 ;
35+ end
36+ 8 : begin
37+ cnt <= 8 + 1 ;
38+ end
39+ 9 : begin
40+ cnt <= 9 + 1 ;
41+ end
42+ 10 : begin
43+ cnt <= 10 + 1 ;
44+ end
45+ 11 : begin
46+ cnt <= 11 + 1 ;
47+ end
48+ 12 : begin
49+ cnt <= 12 + 1 ;
50+ end
51+ 13 : begin
52+ cnt <= 13 + 1 ;
53+ end
54+ 14 : begin
55+ cnt <= 14 + 1 ;
56+ end
57+ 15 : begin
58+ cnt <= 15 + 1 ;
59+ end
60+ 16 : begin
61+ cnt <= 16 + 1 ;
62+ end
63+ 17 : begin
64+ cnt <= 17 + 1 ;
65+ end
66+ 18 : begin
67+ cnt <= 18 + 1 ;
68+ end
69+ 19 : begin
70+ cnt <= 19 + 1 ;
71+ end
72+ 20 : begin
73+ cnt <= 20 + 1 ;
74+ end
75+ 21 : begin
76+ cnt <= 21 + 1 ;
77+ end
78+ 22 : begin
79+ cnt <= 22 + 1 ;
80+ end
81+ 23 : begin
82+ cnt <= 23 + 1 ;
83+ end
84+ 24 : begin
85+ cnt <= 24 + 1 ;
86+ end
87+ 25 : begin
88+ cnt <= 25 + 1 ;
89+ end
90+ 26 : begin
91+ cnt <= 26 + 1 ;
92+ end
93+ 27 : begin
94+ cnt <= 27 + 1 ;
95+ end
96+ 28 : begin
97+ cnt <= 28 + 1 ;
98+ end
99+ 29 : begin
100+ cnt <= 29 + 1 ;
101+ end
102+ 30 : begin
103+ cnt <= 30 + 1 ;
104+ end
105+ 31 : begin
106+ cnt <= 31 + 1 ;
107+ end
108+ default : begin
109+ cnt <= cnt + 1 ;
110+ end
111+
112+ endcase
113+
114+ end
115+ end
116+ assign LED = cnt;
117+ endmodule
118+
Original file line number Diff line number Diff line change 1+ N = 32
2+
3+ header = """\
4+ module TOP(CLK, RST, LED);
5+ input CLK, RST;
6+ output [7:0] LED;
7+ reg [31:0] cnt;
8+ always @(posedge CLK) begin
9+ if(RST) begin
10+ cnt <= 0;
11+ end else begin
12+ """
13+
14+ footer = """\
15+ end
16+ end
17+ assign LED = cnt;
18+ endmodule
19+ """
20+
21+ case_header = """\
22+ case(cnt)
23+ """
24+
25+ case_default = """\
26+ default: begin
27+ cnt <= cnt + 1;
28+ end
29+ """
30+
31+ case_footer = """\
32+ endcase
33+ """
34+
35+ print (header )
36+ print (case_header )
37+
38+ for i in range (N ):
39+ print (i , ': begin' )
40+ print ("cnt <= %d + 1;" % i )
41+ print ('end' )
42+
43+ print (case_default )
44+ print (case_footer )
45+ print (footer )
46+
Original file line number Diff line number Diff line change 11PYTHON = python3
22# OPT=-m pdb
3+ # OPT=-m cProfile -s time
4+ # OPT=-m cProfile -o profile.rslt
35
46PREPROCESS =preprocessor.py
57LEXER =lexer.py
You can’t perform that action at this time.
0 commit comments