diff --git a/tools/oneclick/prestudy/myHDL/inc_comb.py b/tools/oneclick/prestudy/myHDL/inc_comb.py new file mode 100644 index 0000000000000000000000000000000000000000..942a37b47c05e708fe3c0f869ff92a5681009d5f --- /dev/null +++ b/tools/oneclick/prestudy/myHDL/inc_comb.py @@ -0,0 +1,32 @@ +from myhdl import * + +def inc_comb(nextCount, count, n): + + @always(count) + def logic(): + # do nothing here + pass + + nextCount.driven = "wire" + + return logic + +inc_comb.verilog_code =\ +""" +assign $nextCount = ($count + 1) % $n; +""" + +inc_comb.vhdl_code =\ +""" +$nextCount <= ($count + 1) mod $n; +""" + +def convert(): + + nextCount = Signal(intbv(0)[8:]) + count = Signal(intbv(0)[8:]) + + toVerilog(inc_comb, nextCount, count, 256 ) + toVHDL(inc_comb, nextCount, count, 256) + +convert() diff --git a/tools/oneclick/prestudy/myHDL/readme_myHDL.txt b/tools/oneclick/prestudy/myHDL/readme_myHDL.txt index bc49d7e4d5953a0267fd172e8fbf848f86ef23fc..daf786935335092da6f6c3914c2f946f4ed7a3c5 100644 --- a/tools/oneclick/prestudy/myHDL/readme_myHDL.txt +++ b/tools/oneclick/prestudy/myHDL/readme_myHDL.txt @@ -24,4 +24,5 @@ This dir contains: -> Creates tb_muxed_block_gens.v (template TB file) -> Creates pck_myhdl_081.vhd (a package file) -> Creates muxed_block_gens.vhd - +-inc_comb.py: example code from the myHDL Manual, but completed so it generates + output files. It demonstrates how to include user defined code.