3 ms·
That’s a very misleading headline. I got the impression this was something akin to VHDL or Verilog or SystemC in python. “Programming Hardware” the way it’s use
by dialamac 6y ago
That’s a very misleading headline. I got the impression this was something akin to VHDL or Verilog or SystemC in python.
“Programming Hardware” the way it’s used here is pretty much the same as vanilla python, though I suppose a lot in this industry constantly need reminding of that.
- reedwolf 6y agoThere's MyHDL. Turns Python into a hardware description and verification language: https://github.com/myhdl/myhdl https://github.com/myhdl/myhdl
- xvilka 6y agoSee also the list from my low-level hardware description language unification idea[1]. There are mostly active projects. [1] https://github.com/SymbiFlow/ideas/issues/19 https://github.com/SymbiFlow/ideas/issues/19
- senux 6y agoI don't think there's any merit to your argument here. If the headline had said "designing hardware circuits", that would be another story entirely. > “Programming Hardware” the way it’s used here is pretty much the same as vanilla python One can only hope so, since the project is a fork of MicroPython. Neither CPython or MicroPython are meant to be a long departure from Python itself.
- mNovak 6y agoAt a minimum it's unnecessarily vague--hardware is far too broad when it's really just microprocessors. For that matter, in the way they use it, "programming hardware" applies to all code that runs on a computer. Anyway, my first impression was same as parent's, write Python get hardware.
- hulitu 6y ago> I don't think there's any merit to your argument here. If the headline had said "designing hardware circuits", that would be another story entirely. One does not "program hardware" except maybe in a CPLD. You cannot write code for a resistor or a tranzistor. You program maybe the microcontroller which is present on the board.
- unishark 6y ago> If the headline had said "designing hardware circuits", that would be another story entirely. It almost does though. The name of the project has "circuit" in it (I guess because of Arduino applications or something?), and if you are confused why we're talking about circuits, well you can read on where the title goes on to double down on being about "programming hardware".
- dec0dedab0de 6y agoNeither CPython or MicroPython are meant to be a long departure from Python itself. CPython IS the normal Python you get from python.org, It's only ever called CPython when discussing it in the context of other pythons like MicroPython, PyPy, Jython, etc.
- olooney 6y agoI wrote a toy digital circuit simulator[1] as part of a personal "NAND to Tetris" style project. It has none of the bells and whistles of a full simulator but does illustrate how you could write you own in only a few dozen lines of Python. It also has a kind of neat "declarative" syntax inspired by VHDL/Verilog where components (i.e., Verilog modules, VHDL entities) are defined as regular Python classes and describe their contents. For example, here's a half-adder component, which is comprised of a XOR gate and an AND gate: class HalfAdder(Component): def __init__(self, a, b, out=None, c=None): super().__init__() self.a = self.input(a) self.b = self.input(b) self.out = self.output(out) self.c = self.output(c) XOR(a=self.a, b=self.b, out=self.out) AND(a=self.a, b=self.b, out=self.c) having to declare each pin as input or output adds a lot of boilerplate; I was hoping to add a feature where input/output information could be declared using type annotations in the function signature itself. That would look something like: class HalfAdder(Component): def __init__(self, a: input, b: input, out:output = None, c:output = None): super().__init__() XOR(a=self.a, b=self.b, out=self.out) AND(a=self.a, b=self.b, out=self.c) which I think is starting to look pretty Verilog-ish, while still staying Pythonic. [1]: https://github.com/olooney/circuit https://github.com/olooney/circuit