Skip to content
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

Support 8 bit and 16 bit floating point formats #1610

Open
maehne opened this issue Dec 15, 2022 Discussed in #1608 · 7 comments
Open

Support 8 bit and 16 bit floating point formats #1610

maehne opened this issue Dec 15, 2022 Discussed in #1608 · 7 comments

Comments

@maehne
Copy link
Member

maehne commented Dec 15, 2022

Discussed in #1608

Originally posted by juancolonna December 14, 2022
Dear developers, first I'd like to thank you for the amazing work you are doing developing Logisim. Second, I would like to request a new feature if possible.

I use Logisim as a teaching tool with my students. I usually explain initial concepts using 8-bit logic, in a simple way. I often using minifloat (8-bit float) to explain floating number concepts (scale, overflow, etc.). Floating arithmetic blocks don't have the 8-bit option, eg: addition, multiplication, subtraction, etc., and for me it would be very useful. Would it be possible to implement 8-bit float operations? I would be very grateful.

At,

@maehne
Copy link
Member Author

maehne commented Dec 15, 2022

@juancolonna: I converted your discussion topic to a feature request. PRs in this direction are welcome.

@juancolonna
Copy link

Dear @maehne , thanks for your reply. I don't know how to do a PR. I tried to look the source code of Logisim and I feel a little loss. Is there any documentation to guide me?

At,.

@maehne
Copy link
Member Author

maehne commented Dec 20, 2022

@juancolonna: GitHub provides good documentation to get you started on how to use git and their service. Check out Logisim-evolution's developer documentation for specific information on how to contribute to our project.

Regarding the Logisim-evolution source code itself, there's the chapter "JAR libraries" in the "Guide to Being a Logisim User", which you can access from Help -> User's Guide. Unfortunately, it's very likely that some of the information given in there is outdated. However, you you should be able to fill up the holes by looking at the source code itself and asking here. For your feature, have a look at the Fp*.java" files in src/main/java/com/cburch/logisim/std/arith/`. As I pointed out in discussion #1608:

Implementation of the floating point arithmetic blocks is currently based on Java's double data type. Smaller floats would need to get converted manually back and forth to this representation (e.g., see here). One would not only need to adapt these blocks, but also the port and probe components (so that the signal values can be correctly shown when choosing the radix "Float".

In a first step, I would probably start modifying one of the floating point components (e.g., FpNegator.java or FpAdder.java) and try to add the additional bitwidths (8 bit, 16 bit) and modify the conversion of the input values to double and the result to the output value to see whether it works. Only then, I would suggest modifying the ports and probes source code to allow direct display of these floating point values.

@R3dst0ne
Copy link
Contributor

IEEE 754-2019 defines 64, 32 and 16 bit Floating-Point Arithmetic. (the bigger ones are of no interest to LSe.)
I support adding the 16 bit variant.
But to my knowledge, 8-bit Floats are not standardized. Please correct me if I miss something.
If they get added, it is important to document how they work and that they do not follow the IEEE 754 standard.

@imcute-aaaa
Copy link

You do not have 8 bit floats.
They are very small and cannot float.
1 bit sign,3 bit exponent,4 bit mantissa?

@maehne
Copy link
Member Author

maehne commented Jan 10, 2023

Carl Burch's chapter "Floating-point representation" from his book "Computing Systems Organization" might be a base for implementing/documenting this feature.

@juancolonna
Copy link

@R3dst0ne you are right, 8-bit float is not an IEEE standard, however there is a convection followed by some authors and also described in wikepedia. Having support for 8-bit float would be a very nice feature as there are many 8-bit computer projects on the Internet using Logisim. Perhaps, with proper documentation, this support could be added to Logisim.

If you guys think implementing this feature would be a problem, perhaps we could consider implementing 16-bit float. What do you think?

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

No branches or pull requests

4 participants