File tree Expand file tree Collapse file tree 2 files changed +30
-18
lines changed Expand file tree Collapse file tree 2 files changed +30
-18
lines changed Original file line number Diff line number Diff line change @@ -62,6 +62,7 @@ import sys
62
62
import os
63
63
64
64
from veriloggen import *
65
+
65
66
def mkLed ():
66
67
m = Module(' blinkled' )
67
68
width = m.Parameter(' WIDTH' , 8 )
@@ -70,16 +71,21 @@ def mkLed():
70
71
led = m.OutputReg(' LED' , width)
71
72
count = m.Reg(' count' , 32 )
72
73
73
- m.Always(Posedge(clk),
74
- ( If(rst,
75
- ( count.set(0 ), ),
76
- ( count.set(count + 1 ), )), ))
74
+ m.Always(Posedge(clk))(
75
+ If(rst)(
76
+ count(0 )
77
+ ).els(
78
+ count(count + 1 )
79
+ ))
77
80
78
- m.Always(Posedge(clk),
79
- ( If(rst,
80
- ( led.set(0 ), ),
81
- ( If(count == 1024 - 1 ,
82
- ( led.set(led + 1 ), )))), ))
81
+ m.Always(Posedge(clk))(
82
+ If(rst)(
83
+ led(0 )
84
+ ).els(
85
+ If(count == 1024 - 1 )(
86
+ led(led + 1 )
87
+ )
88
+ ))
83
89
84
90
return m
85
91
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ Python as below. A blinking LED hardware is modeled in Python.
73
73
import os
74
74
75
75
from veriloggen import *
76
+
76
77
def mkLed ():
77
78
m = Module(' blinkled' )
78
79
width = m.Parameter(' WIDTH' , 8 )
@@ -81,16 +82,21 @@ Python as below. A blinking LED hardware is modeled in Python.
81
82
led = m.OutputReg(' LED' , width)
82
83
count = m.Reg(' count' , 32 )
83
84
84
- m.Always(Posedge(clk),
85
- ( If(rst,
86
- ( count.set(0 ), ),
87
- ( count.set(count + 1 ), )), ))
85
+ m.Always(Posedge(clk))(
86
+ If(rst)(
87
+ count(0 )
88
+ ).els(
89
+ count(count + 1 )
90
+ ))
88
91
89
- m.Always(Posedge(clk),
90
- ( If(rst,
91
- ( led.set(0 ), ),
92
- ( If(count == 1024 - 1 ,
93
- ( led.set(led + 1 ), )))), ))
92
+ m.Always(Posedge(clk))(
93
+ If(rst)(
94
+ led(0 )
95
+ ).els(
96
+ If(count == 1024 - 1 )(
97
+ led(led + 1 )
98
+ )
99
+ ))
94
100
95
101
return m
96
102
You can’t perform that action at this time.
0 commit comments