mirror of
https://github.com/myhdl/myhdl.git
synced 2025-01-24 21:52:56 +08:00
conversion method
This commit is contained in:
parent
d06a94db0c
commit
6ecce37842
@ -84,6 +84,8 @@ class InstanceError(Error):
|
||||
pass
|
||||
class ModuleError(Error):
|
||||
pass
|
||||
class ModuleInstanceError(Error):
|
||||
pass
|
||||
class CosimulationError(Error):
|
||||
pass
|
||||
class ExtractHierarchyError(Error):
|
||||
|
@ -191,3 +191,11 @@ class _ModuleInstance(object):
|
||||
|
||||
def verify(self):
|
||||
return myhdl.conversion.verify(self)
|
||||
|
||||
def convert(self, hdl='Verilog'):
|
||||
if hdl == 'VHDL':
|
||||
return myhdl.conversion._toVHDL.toVHDL(self)
|
||||
elif hdl == 'Verilog':
|
||||
return myhdl.conversion._toVerilog.toVerilog(self)
|
||||
else:
|
||||
raise ModuleInstanceError('unknown hdl %s' % hdl)
|
||||
|
@ -139,9 +139,9 @@ class _VerificationClass(object):
|
||||
|
||||
if isinstance(func, _ModuleInstance):
|
||||
if hdl == "VHDL":
|
||||
inst = toVHDL(func)
|
||||
inst = func.convert(hdl='VHDL')
|
||||
else:
|
||||
inst = toVerilog(func)
|
||||
inst = func.convert(hdl='Verilog')
|
||||
else:
|
||||
if isinstance(func, _Module):
|
||||
raise TypeError("Module %s: conversion should be on an instance" % func.__name__)
|
||||
|
Loading…
x
Reference in New Issue
Block a user