# GSoC #4: Point Alignment of Fixed-Point Type

**URL:** <https://discourse.myhdl.org/t/gsoc-4-point-alignment-of-fixed-point-type/207>\
**Category:** Synopsis\
**Created:** [July 9, 2017, 2:48pm UTC](https://discourse.myhdl.org/t/gsoc-4-point-alignment-of-fixed-point-type/207 "2017-07-09T14:48:29Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![qrqiuren](https://yyz2.discourse-cdn.com/flex030/user_avatar/discourse.myhdl.org/qrqiuren/32/58_2.png) [@qrqiuren](https://discourse.myhdl.org/u/qrqiuren)\
**Post date:** [July 9, 2017, 2:48pm UTC](https://discourse.myhdl.org/t/gsoc-4-point-alignment-of-fixed-point-type/207/1 "2017-07-09T14:48:29Z")

</div>

Origin blog post is [here](http://qren.logdown.com/posts/2017/07/09/2030465).

This time it leaves a question…

* * *

In the previous post, I thought the point alignment of `fixbv` should be implemented in a short time. Soon I found myself wrong.

After [fixing a compatibility bug](https://github.com/qrqiuren/myhdl/commit/a01efb7a62fea9e936756dd85fbafa94cf618f35) in the unit test `test_fixbv.py`, the problem of point alignment has been revealed.

If point alignment only solved in `_fixbv.py`, in the case of a variable of `Signal` plus or minus a variable of `fixbv`, MyHDL simulator will throw a problem. So I have to implement both in `Signal. __add__ ` and `fixbv. __add__ `. Also, I have to consider if they plus or minus `intbv`.

So, it causes a problem of cross import. I posted [this StackOverflow question](https://stackoverflow.com/questions/44997228/cross-isinstance-in-python) and you may see the implementation.

Temporarily, my solution is (in `fixbv. __add__ `):

```auto
    def __add__ (self, other):
        if isinstance(other, fixbv):
            iW = self._W + other._W
        else:
            # Solve the case if `type(other) is Signal`
            return other. __radd__ (self)

```

This implementation only considered `fixbv` and `Signal`. However, if I consider `intbv`, things might be more complex.

It leaves a question I am going to solve now.
