Pradeep, Thanks.
I am not aware if Python provides the feature of accessing the value by its bit poition: Can we do "if read_data[bit_pos] === poll_val:" in Python? Can you please let me know little bit more about this line? Whether Read_data will be declread as list() or dict()? Thanks, Deepak On Fri, Sep 19, 2008 at 5:44 PM, Pradeep Gowda <[EMAIL PROTECTED]> wrote: > The syntax looks familiar, almost python like. > The equivalent python code would be*: > > def poll_reg(bit_pos, poll_val, reg_offset): > matched = 0 > while matched != 1: > read_data = read_reg(reg_offset) > if read_data[bit_pos] === poll_val: > matched = 1 > else: > matched = 0 > return matched > > * Implementing read_reg is left as an exercise to the developer :p > > I'm not aware of any python library methods which allow one to access > registers. But, the read_reg() can be implmented in C and > imported into Python. > > Any low level operation like register access is usually delegated to . > > HTH, > PG > > > On Sep 19, 2008, at 7:02 PM, Deepak Patel wrote: > > Hello all, >> >> I want to a write a method in Python to poll a register for '1' or '0'. It >> is kind of very simple in verilog, but not sure if python provides >> flexibility or not. >> >> My algorithm (kind of Verilog syntax where I can access the bits without >> any extra processing) is as follows: >> >> poll_reg ( input bit_pos, input poll_val, reg_offset) >> { >> // In this bit_pos is the position of bit in my register read which are >> being polled to become poll_val. Poll_val can be either 0 or 1. >> >> matched = 0; >> while (matched != 1) >> begin >> read_data = read_reg(reg_offset); >> if (read_data[bit_pos] == poll_val) >> begin >> matched = 1; >> end >> else >> begin >> matched = 0; >> end >> end >> } >> >> Is there a way to do above in Python? >> Thanks, >> Deepak >> >> >> >> >> _______________________________________________ >> BangPypers mailing list >> BangPypers@python.org >> http://mail.python.org/mailman/listinfo/bangpypers >> > > Pradeep Kishore Gowda > http://pradeepgowda.com > [EMAIL PROTECTED] > +1-317-564-4660 (Day Phone) > > _______________________________________________ > BangPypers mailing list > BangPypers@python.org > http://mail.python.org/mailman/listinfo/bangpypers >
_______________________________________________ BangPypers mailing list BangPypers@python.org http://mail.python.org/mailman/listinfo/bangpypers