[BangPypers] One python question (from verilog)

Deepak Patel patel.deepak.09 at gmail.com
Sat Sep 20 01:02:28 CEST 2008


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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/bangpypers/attachments/20080919/3d5864c3/attachment.htm>


More information about the BangPypers mailing list