Python for System Verilog testbench

2018-09-13 Thread Bobby


I have a very simple System Verilog (SV) adder as my DUT (device under test). I 
would like to  generate a test bench for this DUT based on the 'requirements'. 
I wrote its  (DUT) functions in simple text as 'requirements' while following a 
particular syntax. Now through  the help of grammar, I would like to give the 
requirement input to the grammar. 

Questions:   

 (1) Considering my end goal, i.e. to generate some particular parts of 
 SV testbench from requirements, any good python parser available ?  

 (2) If I use python parser, will any kind of python scripting will help me 
to generate the testbench in SV for my DUT ? My confusion at this point is that 
most of all the literature I am reading suggests linguistic techniques. Any 
non-linguistic technique ? 

 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python for System Verilog testbench

2018-09-14 Thread Bobby
Hi George

WOW!  thanks for the reply and specially thanks for using the word 'BDD'. I
read the articles regarding BDD the whole day and understood the concepts.
Now will get this Pytest test framework with pytest bdd plugin. I found out
it follows this Gherkin syntax. Then I read about this Gherkin synatx. It
also looks good specially for Verilog. Maybe the syntax I was following
earlier is too complicated.

Some more questions regarding this:

- I read that there are other Python framweorks also
for BDD like 'behave'. What do you suggest as a beginner is Pytest-bdd is
easier or 'behave' ?

- If I am able to successfully map the requirements in pytest-bdd following
this Gherkins syntax, in the end what we get is Python code. To proceed
further, will I have to use Python to Verilog parser for the final Verilog
kind of structure?






On Friday, September 14, 2018, George Fischhof  wrote:
>
>
> Bobby  ezt írta (időpont: 2018. szept. 14., P
0:16):
>>
>> I have a very simple System Verilog (SV) adder as my DUT (device under
test). I would like to  generate a test bench for this DUT based on the
'requirements'. I wrote its  (DUT) functions in simple text as
'requirements' while following a particular syntax. Now through  the help
of grammar, I would like to give the requirement input to the grammar.
>>
>> Questions:
>>
>>  (1) Considering my end goal, i.e. to generate some particular parts
of
>>  SV testbench from requirements, any good python parser
available ?
>>
>>  (2) If I use python parser, will any kind of python scripting will
help me to generate the testbench in SV for my DUT ? My confusion at this
point is that most of all the literature I am reading suggests linguistic
techniques. Any non-linguistic technique ?
>>
>>
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>
> Hi,
> Perhaps you should check articles about BDD,  and you can use PyTest test
framework with pytest-bdd plugin
> __george__
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Python-Verilog (Pyverilog)

2018-10-15 Thread Bobby
I am working on my own domain-specific language (DSL). The DSL is based on 
functional requirements of a device under test (DUT). The grammar has rules 
like 'if' and 'else'. I have made a grammar of my DSL without any programming 
code in my grammar. I am using ANTLR to generate Parser, Lexer, Visitor and 
Listeners in Python. I have made the visitor pattern in python to parse the 
input I give to my grammar. The input I am parsing is in natural words as my 
grammar itself consists of natural words rules. Therefore the input is not a 
programming language. Now I have a working visitor in python which can 
successfully interpret my input.
 
I would like to generate a Verilog test bench structure from this stage on 
wards. Literally blocked at this point. I have come across this toolkit 
Pyverilog. It has a Verilog code generator as a tool. In this Verilog code 
generator, a Verilog HDL code is represented by using the AST classes defined 
in its parser called'vparser.ast'.

Can I use this code generator as a standalone for my Python visitor pattern 
which I have made from my ANTLR ? Any workaround that I can use this kit 
considering the above mentioned scenario ?

I would appreciate any suggestion. 

-- 
https://mail.python.org/mailman/listinfo/python-list


Python-Verilog (PyHDI-Pyverilog)

2018-10-15 Thread Bobby



I am working on my own domain-specific language (DSL). The DSL is based on 
functional requirements of a device under test (DUT). The grammar has rules 
like 'if' and 'else'. I have made a grammar of my DSL without any programming 
code in my grammar. I am using ANTLR to generate Parser, Lexer, Visitor and 
Listeners in Python. I have made the visitor pattern in python to parse the 
input I give to my grammar. The input I am parsing is in natural words as my 
grammar itself consists of natural words rules. Therefore the input is not a 
programming language. Now I have a working visitor in python which can 
successfully interpret my input. 
  
I would like to generate a Verilog test bench structure from this stage on 
wards. Literally blocked at this point. I have come across this toolkit 
Pyverilog (https://github.com/PyHDI/Pyverilog). It has a Verilog code generator 
as a tool. In this Verilog code generator, a Verilog HDL code is represented by 
using the AST classes defined in its parser called'vparser.ast'. 

Can I use this code generator as a standalone for my Python visitor pattern 
which I have made from my ANTLR ? Any workaround that I can use this kit 
considering the above mentioned scenario ? 

I would appreciate any suggestion.
-- 
https://mail.python.org/mailman/listinfo/python-list


USB Missile.

2006-12-27 Thread Bobby
I am trying to create a python version of the M&S USB Missile Launcher
code for Windows.

I am basing it off one designed for linux.

I note the following about dependencies:

Requirements:
-
  0. python (>=2.3)
-Fine
  1. libusb (>=0.1.2)
-Fine, however the windows version has the following note:
   If you are porting a libusb based program from Unix
style systems to Windows, remove all references to the library's global
variable usb_busses. Use the function usb_get_busses()  instead to get
this variable. Global variables in shared libraries (DLLs) do not work
on Windows systems across different compilers.
  2. pyusb (==0.3.1) python module with patch (to enable kernel
detachment)
 -Fine, besides patch since this does not seem to be
windows compatible (patch is hosted at
http://scott.weston.id.au/software/pymissile/pyusb-0.3.1-kernel-detach.patch)
  3. urwid python module
 -Fine

I am trying to use the following code at
http://scott.weston.id.au/software/pymissile/missile.py but with the
following lines removed due to the patch above not being applied:
self.handle.detachKernelDriver(0)
self.handle.detachKernelDriver(1)

It loads okay, but gives the following error:

Traceback (most recent call last):
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 367, in
?
main(sys.argv[1:])
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 361, in
main
MissileDisplay().main()
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 156, in
main
self.ui.run_wrapper(self.run)
  File "C:\Python24\lib\urwid\curses_display.py", line 179, in
run_wrapper
return fn()
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 197, in
run
m.move(MissileDevice.LEFTUP)
  File "C:\Documents and Settings\Bob\Desktop\missile.py", line 83, in
move
self.dev.handle.controlMsg(0x21, 0x09, self.INITA, 0x02, 0x01)
usb.USBError: usb_control_msg: sending control message failed, win
error: The de
vice does not recognize the command.


Does anyone have any ideas of how to solve this error? I thought it
might have something to do with
busses = usb.busses()
in the python, but libusb requiring the function usb_get_busses() to be
used to obtain the usb_busses variable.

I don't however have much python experience.

Thanks.

-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Unpack less values from function's return values

2009-05-28 Thread Bobby
On May 28, 5:40 am, Chris Rebert  wrote:
> On Thu, May 28, 2009 at 3:19 AM,   wrote:
> > Hi,
>
> > I'm using Python 2.5.2. I'm getting this error whenever I try to unpack less
> > values from a function.
>
> > ValueError: too many values to unpack
>
> > I want to know if there is a way I can unpack less values returning from a
> > function?
>
> Unpack them into throwaway variables:
>
> def foo(): return 1,2,3,4
>
> a, b, _, _ = foo()
>
> In very new Python, you can also do:
>
> a, b, *_ = foo()
>
> Cheers,
> Chris
> --http://blog.rebertia.com

You could also do something like
a,b = foo()[:2]
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Questions about regex

2009-05-29 Thread Bobby
On May 29, 1:26 pm, jared.s.ba...@gmail.com wrote:
> Hello,
>
> I'm new to python and I'm having problems with a regular expression. I
> use textmate as my editor and when I run the regex in textmate it
> works fine, but when I run it as part of the script it freezes. Could
> anyone help me figure out why this is happening and how to fix it.
> Here is the script:
>
> ==
> # regular expression search and replace
> import sys, os, re, string, csv
>
> #Open the file and taking its data
> myfile=open('Steve_query3.csv') #Steve_query_test.csv
> #create an error flag  to loop the script twice
> #store all file's data in the string object 'text'
> myfile.seek(0)
> text = myfile.read()
>
> for i in range(2):
>         #def textParse(text, reRun):
>         print 'how many times is this getting executed', i
>
>         #Now to create the newfile 'test' and write our 'text'
>         newfile = open('Steve_query3_out.csv', 'w')
>         #open the new file and set it with 'w' for "write"
>         #loop trough 'text' clean them up and write them into the 'newfile'
>                         #sub(   pattern, repl, string[, count])
>                         #"sub("(?i)b+", "x", " ")" returns 'x x'.
>         text = re.sub('(\<(/?[^\>]+)\>)', "", text)#remove the HTML
>         text = re.sub('//', "", text) #remove comments  
>         text = re.sub('\/\*(.|\s)*?;}', "", text) #remove css formatting
>         #remove a bunch of word formatting yuck
>         text = re.sub(" ", " ", text)
>         text = re.sub("<", "<", text)
>         text = re.sub(">", ">", text)
>         text = re.sub(""|&rquot;|“", "\'", text)
> #===
> #The two following lines are the ones giving me the problems
>         text = re.sub("w:(.|\s)*?\n", "", text)
>         text = re.sub("UnhideWhenUsed=(.|\s)*?\n", "", text)
> #===
>         text = re.sub(re.compile('^\r?\n?$', re.MULTILINE), '', text) #remove
> the extra whitespace
>         #now write out the new file and close it
>         newfile.write(text)
>         newfile.close()
>
>         #open the newfile and run the script again
>         #Open the file and taking its data
>
>         myfile=open('Steve_query3_out.csv') #Steve_query_test.csv
>         #store all file's data in the string object 'text'
>         myfile.seek(0)
>         text = myfile.read()
>
> Thanks for the help,
>
> -Jared

Can you give a string that you would expect the regex to match and
what the expected result would be? Currently, it looks like the
interesting part of the regex (.|\s)*? would match any character of
any length once. There seems to be some redundancy that makes it more
confusing then it needs to be. I'm pretty sure that . will also match
anything that \s will match or maybe you just need to escape . because
you meant for it to be a literal.
-- 
http://mail.python.org/mailman/listinfo/python-list


python server developer

2009-11-21 Thread Bobby
Hello,
We are looking for Python server developer
location : Hyderabad
Experience : 3 years .
Send me your updated resume with availability for Telephonic interview
-- 
http://mail.python.org/mailman/listinfo/python-list


New to unix/python. How to install

2005-02-06 Thread Bobby Owens
Hi,

Please excuse what is probably a completely newbie question, but my
situation is as follows.

I'm a windows/.NET developer but have now been asked to take over part
of the project which is written in python and runs on Unix.

I've muddled through the python code and figured out parts of it. I've
now installed Sun Solaris 10 on a VM ware installation successfully
and can muddle thorough the basics of the o/s. I cant figure out how
to install python. From looking online I've found what I think I need:

- python-2.3.3-sol9-intel-local
- libgcc-3.3-sol10-intel-local

I know the python looks like from only v9 of solaris but it was within
a sol10 package I found online.

>From what I understand, I need the "libgcc" to compile the python
intstall. I cant figure out how to install them both however. Could
any kind souls please lend a hand. It would be much appreciated.

Either post here or pm me.

Regards

Bobby
[EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list


MESSAGE COULD NOT BE DELIVERED

2005-04-14 Thread bobby . okinaka
--  Virus Warning Message (on cesio.consuldata.com.br)

Found virus WORM_MYDOOM.M in file qvupy.html
.scr (in qvupy.zip)
The uncleanable file is deleted.

Para maiores informacoes, contate o suporte da ConsulData: +55 (13) 3219-6522 
ou [EMAIL PROTECTED]

-
The original message was received at Thu, 14 Apr 2005 12:12:03 -0300 from 
104.172.167.90

- The following addresses had permanent fatal errors -
python-list@python.org

- Transcript of session follows -
... while talking to python.org.:
554 Service unavailable; [34.213.113.121] blocked using bl.spamcop.net
Session aborted, reason: lost connection


--  Virus Warning Message (on cesio.consuldata.com.br)

qvupy.zip is removed from here because it contains a virus.

--- 
http://mail.python.org/mailman/listinfo/python-list

Homework help

2008-04-01 Thread bobby . connor
Hey guys
I haev this homework assignment due today
I don't necessarily want the answers, but need help on how to approach
it/the steps i need to solve the problems
Thanks

#  (2 Points) Write a python function howMany(item,lst) which accepts
an item and a lst of items and returns the number of times item occurs
in lst. For example, howMany(3,[1,2,3,2,3]) should return 2.

# (2 Points) Write a python function upTo(n) which accepts a non-
negative number n and returns a list of numbers from 0 to n. For
example, upTo(3) should return the list [0, 1, 2, 3].

# (2 Points) Write a python function duplicate(lst) which accepts a
lst of items and returns a list with the items duplicated. For
example, duplicate([1,2,2,3]) should return the list [1, 1, 2, 2, 2,
2, 3, 3].

# (2 Points) Write a python function dotProduct(a,b) which accepts two
lists of integers a and b that are of equal length and which returns
the dot product of a and b. I.e., the sum a0 * b0 + ... + an-1 * bn-1
where n is the length of the lists. For example:

dotProduct([1,2,3],[4,5,6]) is 1*4 + 2*5 + 3*6 = 4 + 10 + 18 = 32

# (2 Points) A pair (exp0, exp1) is a combination of expressions that
are attached together by their joint membership in the pair. For
example:

>>> (1+2, 'This')
(3, 'This')

A component of a pair can be obtained using an index in brackets as
with lists (and strings!). For example:

>>> (33,44)[0]
33

Write a function zip(lst1, lst2) such that zip accepts two equal
length lists and returns a list of pairs. For example, zip(['a', 'b',
'c'], [10, 20, 30]) should evaluate to the list [('a', 10), ('b', 20),
('c', 30)].

# (2 Points) Write a function unzip(lst) such that unzip accepts a
list of pairs and returns two lists such that lst == zip(unzip(lst)).
For example, unzip([('a', 10), ('b', 20), ('c', 30)] should evaluate
to the pair (['a', 'b', 'c'], [10, 20, 30]).

# (2 Points) Write a python function isAscending(lst) which accepts a
non-empty list of integers and returns True if the numbers in the list
are in ascending order. Otherwise it should return False. For example,
isAscending([1]) should evaluate to True while isAscending([1,2,2])
should return False.
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: Homework help

2008-04-01 Thread bobby . connor
On Apr 1, 12:17 pm, Paul Rubin  wrote:
> [EMAIL PROTECTED] writes:
> > I don't necessarily want the answers, but need help on how to approach
> > it/the steps i need to solve the problems
>
> What parts are you having difficulty with?  Are there some course
> materials and have you read them yet?

I just don't know how to start the problems off
-- 
http://mail.python.org/mailman/listinfo/python-list


finding domain name

2008-09-23 Thread Bobby Roberts
hi group.  I'm new to python and need some help and hope you can
answer this question.  I have a situation in my code where i need to
create a file on the server and write to it.  That's not a problem if
i hard code the path.  However, the domain name needs to be dynamic so
it is picked up automatically.  The path to our websites is

home/sites/x/

where x represents the domain name.

How can I find the domain name of the current url being viewed.
--
http://mail.python.org/mailman/listinfo/python-list


Re: finding domain name

2008-09-23 Thread Bobby Roberts

> Depends on the technology/web framework. If you use WSGI, you should use
> something like:
>
> host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"]
>
> -- Gerhard

Yeah i already tried environ("SERVER_NAME") but get a key error when i
do.

--
http://mail.python.org/mailman/listinfo/python-list


Re: finding domain name

2008-09-23 Thread Bobby Roberts
On Sep 23, 8:54 am, "Joe Riopel" <[EMAIL PROTECTED]> wrote:
> On Tue, Sep 23, 2008 at 8:37 AM, Bobby Roberts <[EMAIL PROTECTED]> wrote:
> > hi group.  I'm new to python and need some help and hope you can
> > answer this question.  I have a situation in my code where i need to
> > create a file on the server and write to it.  That's not a problem if
> > i hard code the path.  However, the domain name needs to be dynamic so
> > it is picked up automatically.  The path to our websites is
>
> > home/sites/x/
>
> > where x represents the domain name.
>
> > How can I find the domain name of the current url being viewed.
>
> I would guess that a pretty simple regular expression might do it.

can you explain?
--
http://mail.python.org/mailman/listinfo/python-list


Re: finding domain name

2008-09-23 Thread Bobby Roberts
On Sep 23, 9:10 am, Tino Wildenhain <[EMAIL PROTECTED]> wrote:
> Bobby Roberts wrote:
> >> Depends on the technology/web framework. If you use WSGI, you should use
> >> something like:
>
> >> host_name = environ.get("HTTP_HOST", None) or environ["SERVER_NAME"]
>
> >> -- Gerhard
>
> > Yeah i already tried environ("SERVER_NAME") but get a key error when i
> > do.
>
> You could output the whole environ to see what you get and how it is called.
>
> I'd recommend however to check that you are using a configured value and
> not something sent by the client if you are going to use it during
> filesystem lookup.
>
> Regards
> Tino
>
>  smime.p7s
> 4KViewDownload

evidently the environ dictionary is off limits on our server. It can't
be that tough in python to get the current complete url being viewed.
It's a snap in asp(which is my background).
--
http://mail.python.org/mailman/listinfo/python-list


Re: finding domain name

2008-09-23 Thread Bobby Roberts
On Sep 23, 1:23 pm, Bruno Desthuilliers
<[EMAIL PROTECTED]> wrote:
> Bobby Roberts a écrit :
>
> > hi group.  I'm new to python and need some help and hope you can
> > answer this question.  I have a situation in my code where i need to
> > create a file on the server and write to it.  That's not a problem if
> > i hard code the path.  However, the domain name needs to be dynamic so
> > it is picked up automatically.  The path to our websites is
>
> > home/sites/x/
>
> > where x represents the domain name.
>
> > How can I find the domain name of the current url being viewed.
>
> What are you using exactly ? cgi ? wsgi ? Else ?

mod python over an in-house framework written years ago without
documentation so it's not the easiest thing to navigate.  We will be
moving to django this fall.
--
http://mail.python.org/mailman/listinfo/python-list


empty csv file attachments

2008-09-24 Thread Bobby Roberts
hi group.

I'm new to python but a veteran at programming.  This one has me
stumped.  I have a simple contact form which the user fills out.  The
email is sent to the site user as well and it is delivered with the
content in the body of the email as well in nice order.  I have
modified my code to also send the content as a csv attachment.  On the
server, the file is perfectly generated with content.  The attachment,
however, is completely blank.  Any ideas what that could be?  My code
snippet is shown below:


  if int(attachmenttype)==2 or int(attachmenttype)==3:
for field in ctx.request.field_names():
  if field=='last_name':
myfilename=ctx.request.field_value(field)+'.txt'
if myfilename=='':
  myfilename='tempfile.txt'
mypath= mynewfilepath + '/' + myfilename
f=open(mypath, 'w')
mynewstring=''
counter=0
for field in ctx.request.field_names():
  if field != 'inquiry_required':
mynewstring=mynewstring + field +','
if mynewstring[-1]==',':
  mynewstring=mynewstring[0:len(mynewstring)-1]
f.write(mynewstring)
f.write ('\n')

mynewstring=''
counter=1
for field in ctx.request.field_names():
  fielddata=ctx.request.field_value(field)
  if counter==1:
dummydata=0
  else:
mynewstring=mynewstring + '"' + fielddata.replace('"','')
+ '",'
  counter = counter + 1
if mynewstring[-1]==',':
  mynewstring=mynewstring[0:len(mynewstring)-1]
f.write(mynewstring)
f.write('\n')
f.close
attachments.append('/'.join((ctx.request.library,
myfilename)))

 [snip... sends email just after this]

any ideas?
--
http://mail.python.org/mailman/listinfo/python-list


empty csv file attachments

2008-09-24 Thread Bobby Roberts
hi group.

I'm new to python but a veteran at programming.  This one has me
stumped.  I have a simple contact form which the user fills out.  The
email is sent to the site user as well and it is delivered with the
content in the body of the email as well in nice order.  I have
modified my code to also send the content as a csv attachment.  On the
server, the file is perfectly generated with content.  The attachment,
however, is completely blank.  Any ideas what that could be?  My code
snippet is shown below:


  if int(attachmenttype)==2 or int(attachmenttype)==3:
for field in ctx.request.field_names():
  if field=='last_name':
myfilename=ctx.request.field_value(field)+'.txt'
if myfilename=='':
  myfilename='tempfile.txt'
mypath= mynewfilepath + '/' + myfilename
f=open(mypath, 'w')
mynewstring=''
counter=0
for field in ctx.request.field_names():
  if field != 'inquiry_required':
mynewstring=mynewstring + field +','
if mynewstring[-1]==',':
  mynewstring=mynewstring[0:len(mynewstring)-1]
f.write(mynewstring)
f.write ('\n')

mynewstring=''
counter=1
for field in ctx.request.field_names():
  fielddata=ctx.request.field_value(field)
  if counter==1:
dummydata=0
  else:
mynewstring=mynewstring + '"' + fielddata.replace('"','')
+ '",'
  counter = counter + 1
if mynewstring[-1]==',':
  mynewstring=mynewstring[0:len(mynewstring)-1]
f.write(mynewstring)
f.write('\n')
f.close
attachments.append('/'.join((ctx.request.library,
myfilename)))

 [snip... sends email just after this]

any ideas?
--
http://mail.python.org/mailman/listinfo/python-list


csv files for download

2008-10-04 Thread Bobby Roberts
I need to be able to offer a client "click to download" functionality
on their website.  Generating the data to provide to them is not an
issue but I want them to be able to click a button and have the
response be sent to a csv file which they are prompted to download.
Can someone point me in the right direction how to do this in python.
Thanks in advance.
--
http://mail.python.org/mailman/listinfo/python-list