Skip to content

Commit 3be053f

Browse files
committed
Example in README is updated
1 parent 5724967 commit 3be053f

File tree

2 files changed

+67
-74
lines changed

2 files changed

+67
-74
lines changed

README.md

Lines changed: 33 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -127,48 +127,45 @@ Run the script.
127127
python led.py
128128
```
129129

130-
You will have a complete Verilog HDL source code that is generated by a source code generator of Pyverilog.
131-
Currently a source code generated by Pyverilog has no good indentation. Please prettify it by using a standard text editor.
130+
You will have a complete Verilog HDL source code that is generated by the source code generator of Pyverilog.
132131

133132
```verilog
134133
module blinkled #
135-
(
134+
(
136135
parameter WIDTH = 8
136+
)
137+
(
138+
input CLK,
139+
input RST,
140+
output reg [(WIDTH - 1):0] LED
141+
);
137142
138-
)
139-
(
140-
input [0:0] CLK,
141-
input [0:0] RST,
142-
output reg [(WIDTH - 1):0] LED
143-
144-
);
145143
reg [(32 - 1):0] count;
146-
always @(posedge CLK)
147-
begin
148-
if(RST) begin
149-
count <= 0;
150-
end
151-
else begin
152-
if((count == 1023)) begin
153-
count <= 0;
154-
end
155-
else begin
156-
count <= (count + 1);
157-
end
158-
end
159-
end
160-
always @(posedge CLK)
161-
begin
162-
if(RST) begin
163-
LED <= 0;
164-
end
165-
else begin
166-
if((count == 1023)) begin
167-
LED <= (LED + 1);
168-
end
169-
170-
end
171-
end
144+
145+
always @(posedge CLK) begin
146+
if(RST) begin
147+
count <= 0;
148+
end else begin
149+
if((count == 1023)) begin
150+
count <= 0;
151+
end else begin
152+
count <= (count + 1);
153+
end
154+
end
155+
end
156+
157+
158+
always @(posedge CLK) begin
159+
if(RST) begin
160+
LED <= 0;
161+
end else begin
162+
if((count == 1023)) begin
163+
LED <= (LED + 1);
164+
end
165+
end
166+
end
167+
168+
172169
endmodule
173170
```
174171

README.rst

Lines changed: 34 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -144,51 +144,47 @@ Run the script.
144144

145145
python led.py
146146

147-
You will have a complete Verilog HDL source code that is generated by a
148-
source code generator of Pyverilog. Currently a source code generated by
149-
Pyverilog has no good indentation. Please prettify it by using a
150-
standard text editor.
147+
You will have a complete Verilog HDL source code that is generated by
148+
the source code generator of Pyverilog.
151149

152150
.. code:: verilog
153151
154152
module blinkled #
155-
(
153+
(
156154
parameter WIDTH = 8
155+
)
156+
(
157+
input CLK,
158+
input RST,
159+
output reg [(WIDTH - 1):0] LED
160+
);
157161
158-
)
159-
(
160-
input [0:0] CLK,
161-
input [0:0] RST,
162-
output reg [(WIDTH - 1):0] LED
163-
164-
);
165162
reg [(32 - 1):0] count;
166-
always @(posedge CLK)
167-
begin
168-
if(RST) begin
169-
count <= 0;
170-
end
171-
else begin
172-
if((count == 1023)) begin
173-
count <= 0;
174-
end
175-
else begin
176-
count <= (count + 1);
177-
end
178-
end
179-
end
180-
always @(posedge CLK)
181-
begin
182-
if(RST) begin
183-
LED <= 0;
184-
end
185-
else begin
186-
if((count == 1023)) begin
187-
LED <= (LED + 1);
188-
end
189-
190-
end
191-
end
163+
164+
always @(posedge CLK) begin
165+
if(RST) begin
166+
count <= 0;
167+
end else begin
168+
if((count == 1023)) begin
169+
count <= 0;
170+
end else begin
171+
count <= (count + 1);
172+
end
173+
end
174+
end
175+
176+
177+
always @(posedge CLK) begin
178+
if(RST) begin
179+
LED <= 0;
180+
end else begin
181+
if((count == 1023)) begin
182+
LED <= (LED + 1);
183+
end
184+
end
185+
end
186+
187+
192188
endmodule
193189
194190
Publication

0 commit comments

Comments
 (0)