Skip to content

Commit 62a869e

Browse files
committed
Some features such as bit concat, slice, pointer, and integer with width are implemented.
1 parent 1db4d72 commit 62a869e

File tree

16 files changed

+171
-8
lines changed

16 files changed

+171
-8
lines changed

sample/led-class/veriloggen

Lines changed: 0 additions & 1 deletion
This file was deleted.

sample/led-fsm/veriloggen

Lines changed: 0 additions & 1 deletion
This file was deleted.
File renamed without changes.

sample/test/cat/led.py

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
import sys
2+
import os
3+
4+
from veriloggen import *
5+
6+
def mkLed():
7+
m = Module('blinkled')
8+
width = m.Parameter('WIDTH', 8)
9+
clk = m.Input('CLK')
10+
rst = m.Input('RST')
11+
led = m.OutputReg('LED', width)
12+
count = m.Reg('count', 32)
13+
14+
m.Always(Posedge(clk))(
15+
If(rst)(
16+
count(0)
17+
).Else(
18+
count(count + 1)
19+
))
20+
21+
m.Always(Posedge(clk))(
22+
If(rst)(
23+
led(Int(0b00000001, width=8, base=2))
24+
).Else(
25+
If(count == 1024 - 1)(
26+
led( Cat(led[width-2:0], led[width-1]) )
27+
)
28+
))
29+
30+
return m
31+
32+
led = mkLed()
33+
verilog = led.to_verilog()
34+
print(verilog)

sample/test/cat/veriloggen

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../veriloggen
File renamed without changes.
File renamed without changes.

sample/test/class/veriloggen

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../../veriloggen

sample/test/fsm/Makefile

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
TARGET=led.py
2+
ARGS=
3+
4+
PYTHON=python3
5+
#PYTHON=python
6+
#OPT=-m pdb
7+
#OPT=-m cProfile -s time
8+
#OPT=-m cProfile -o profile.rslt
9+
10+
.PHONY: all
11+
all: run
12+
13+
.PHONY: run
14+
run:
15+
$(PYTHON) $(OPT) $(TARGET) $(ARGS)
16+
17+
.PHONY: check
18+
check:
19+
$(PYTHON) $(OPT) $(TARGET) $(ARGS) > tmp.v
20+
iverilog -tnull -Wall tmp.v
21+
rm -f tmp.v
22+
23+
.PHONY: clean
24+
clean:
25+
rm -rf *.pyc __pycache__ parsetab.py *.out

sample/led-fsm/led.py renamed to sample/test/fsm/led.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,5 +29,5 @@ def mkLed():
2929
return m
3030

3131
led = mkLed()
32-
verilog = led.to_verilog("tmp.v")
32+
verilog = led.to_verilog()
3333
print(verilog)

0 commit comments

Comments
 (0)