Code Monkey home page Code Monkey logo

fixed's People

Stargazers

 avatar

Watchers

 avatar  avatar

fixed's Issues

Rounding method has a corner case

The half-adder rounding method can produce outputs that exceed the intended output range. Example: 5-bit value 15 roundBy(2) will produce the value 4, which exceeds the range of a 3-bit 2's complement integer. This should probably be fixed by saturating the offending outputs to the new output range.

Look into the explicit keyword

C++ lets you use the explicit keyword in some cases to avoid copying of classes when you don't want it. You may want to use this for FixedPoint/ComplexFixedPoint.

Determine how to include this project as a dependency of other projects

For example, let's say I create a Visual C++ project AmazingDSP that has fixed as a dependency, and AmazingDSP is version controlled with Git. Ideally, I would like to be able to clone AmazingDSP from the repository using Git and have fixed be pulled down from GitHub (perhaps from a particular tag or commit to avoid version conflicts) automatically. This avoids a manual procedure like "clone AmazingDSP, then cd into this directory, then clone fixed and checkout this particular tag." Besides being a burden on anyone who wants to use AmazingDSP project, this also complicates automated continuous integration using BuildBot which also needs to checkout and build the project from source.

Possible solutions:

  1. Git submodules. Submodules seem to do what I want in terms of tracking a particular commit hash of a separate repository, but the clone process is apparently not quite as automatic as I'd like without passing a special flag to the clone command. I've also read that submodules are cumbersome to work with and may induce much pain and suffering, but I don't understand the specific problems.
  2. Separate dependency manager. This seems like overkill, but if something lightweight exists I'd consider it.
  3. CMake? I believe CMake checks for dependencies, but I don't think it just informs you that they are missing rather than install them for you. But perhaps there is a way to do this. On the other hand, I'm not sure I want to go the CMake route for Windows development. Yet another complex piece of software to learn which would distract from my real job.
  4. Does Visual Studio have such features?
  5. Give up and just do it manually.

References:
http://blogs.atlassian.com/2014/04/git-project-dependencies/

Enhancify: add support for user-defined literals

C++11 adds the ability for classes to implement user-defined literals. Hypothetically, with this feature, you could make it so that writing 1.234_fxp anywhere in a code file will create a Fxp literal with that value.

This may not work so well when you want multiple values (e.g. value and bit length, or real and imaginary part). Deserves some investigation.

Should resizing functions modify the object called on, or return a new modified object?

Resizing functions (round, truncate, saturate, etc.) could work one of two ways:

  1. Object the method is called on gets modified. Return value is a reference to itself after modification. This is how the methods are currently written.
  2. When a resizing method is called a new object is created with the new size and this new object is passed as the return value. The original object remains unmodified.

Remove << and >> operators

These operators are already private and their intended behavior is not obvious. Only >> is used in truncateBy() where the functionality can be replaced.

Default constructor suggestion

Suggest setting width to an "invalid" value in the default constructor; on first assignment, this is set to the width of the rhs.

Compound assignment operators inconsistent with regular assignment

Compound operators += and *= resize the lhs object even when the width is immutable under assignment. This is inconsistent with the behavior of the regular assignment operator =, which throws an exception if the width of the rhs does not match the lhs.

There may be cases where it is desirable for operators like += to not result in a size change. For example, in an accumulator. However, this would require an implicit size reduction, which violates one of the principles of the project (no implicit resizing).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.