New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Boolean Function array type #68

Closed
cjdrake opened this Issue Feb 10, 2014 · 1 comment

Comments

Projects
None yet
1 participant
@cjdrake
Owner

cjdrake commented Feb 10, 2014

The way PyEDA's bit vectors work today is useful for some things, but otherwise fubar.

Functions for producing inputs:

  • exprzeros(*dims) -> farray - Create a shaped multi-dimensional array of Expression zeros
  • exprones(*dims) -> farray - Create a shaped multi-dimensional array of Expression ones
  • exprvars(name, *dims) -> farray - Create a shaped multi-dimensional array of Expression variables

Similarly for bddzeros, and so on.

Example usage:

exprzeros(4)
exprones(2, 2)
exprvars('x', (2, 4), (3, 5))

The farray data type:

Need a data type similar to np.array that not only supports multi-dimensional arrays of Boolean functions, but supports advanced indexing. The farray type should store things in a flat array, but use a shape parameter to interpret how to index the stored values. Unlike Numpy, it needs to support arbitrary offsets for the indices.

This is still a draft, so the methods/attributes list will (hopefully) grow.

Methods:

  • __len__
  • __getitem__
  • __setitem__

The __getitem__ method will look like Numpy's array slicing, with the goal of supporting everything SystemVerilog can do with slices. For an int key, it should just return the sub-array at that index. For a tuple key, it should support int, slice, Ellipsis, and all that stuff. For a Function or farray key, it should return a new function that creates mux logic, eg F[g] should multiplex the items of F over (g', g), and F[(g0, g1)] should multiplex the items of F over (g1'g0', g1'g0, g1g0', g1g0), and so on.

Attributes:

  • size - total number of elements in the bfarray
  • shape - tuple of tuples, eg ((2, 4), (3, 5))
  • flat - return a 1-D iterator over the functions.

Helper Functions

For convenient concatenation of farray objects, will need a fcat function:

fcat(xs, ys)

References:

@cjdrake cjdrake added the Change label Feb 10, 2014

cjdrake added a commit that referenced this issue Mar 10, 2014

Implement new pyeda.boolalg.bfarray module
Partially addresses issue #68, which proposes a new Boolean function
array type.

cjdrake added a commit that referenced this issue Mar 10, 2014

Implement new pyeda.boolalg.bfarray module
Partially addresses issue #68, which proposes a new Boolean function
array type.
@cjdrake

This comment has been minimized.

Owner

cjdrake commented Mar 10, 2014

This still needs some work, and would like to convert various old logic contents before closing this.

cjdrake added a commit that referenced this issue Mar 15, 2014

Implement new pyeda.boolalg.bfarray module
Partially addresses issue #68, which proposes a new Boolean function
array type.

@cjdrake cjdrake closed this Mar 25, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment