[myhdl-list] New way of specifying user defined code, not working inside class
Brought to you by:
jandecaluwe
From: Wesley N. <we...@sk...> - 2012-01-19 11:51:52
|
Hi All, I have had to change the way my uesr-defined code was written to the new method, using <func>.verilog_code but I am having a problem using it inside a class. Here is the code: from myhdl import * class sw_reg: def __init__(self): #self.sw_reg_r_wrapper.__dict__['verilog_code'] = "verilog" #self.sw_reg_r_wrapper.verilog_code = "verilog" temp2 = 0 def sw_reg_wrapper(self, wb_clk_i): #======================== # TODO:Simulation Logic #======================== @always(wb_clk_i.posedge) def logic(): temp = 1 return logic sw_reg_r_wrapper.verilog_code = "verilog code blah blah" But when I call the toVerilog method, as below, it doesnt use the user-defined code (Note: this works when there is no class) #======================================= # For testing of conversion to verilog #======================================= def convert(): x = sw_reg_r() wb_clk_i = Signal(bool(0)) toVerilog(x.sw_reg_r_wrapper, wb_clk_i=wb_clk_i) if __name__ == "__main__": convert() I have tried adding the verilog_code explicitly to the dictionary associated with the function (See the commented lines in the __init__ function) but this doesnt work either. What am I doing wrong? Thanks for you time. Wesley |