mathstodon.xyz is one of the many independent Mastodon servers you can use to participate in the fediverse.
A Mastodon instance for maths people. We have LaTeX rendering in the web interface!

Server stats:

2.8K
active users

#systemverilog

1 post1 participant0 posts today

After getting a basic ALU design done yesterday & starting a **very** rough start at a microcodeish thing, today the first design of the controlunit & overall cpu design comes together, so it can actually calculate an addition from two arbitary registers and store the result back into a register of choice! :3

Still a lot to go but excited it works already somewhat! #hardware #fantasyconsole #diy #verilog #systemverilog #software #cpudesign #hardwaredesign #fpga #fpgadev

looks like in #SystemVerilog when you prefix a task's argument with "ref", the parser thinks all the following arguments are also references¹, a là declaring the arguments without specifying the type for each², so you have to make the references the last arguments and call the task with (x, , z) if there are optional arguments (with default values) in-between
the LRM doesn't seem to clearly specify this behavior
I don't like this language at all, and I don't understand why people even prefer it

¹ i.e. (ref first_t a, second_t b) is the same as (ref first_t a, ref second_t b)
² where (first_t a, b) is the same as (first_t a, first_t b)
stereophonic.spaceStereophonica
Continued thread
often I see RTL designers use non-blocking assignment everywhere, with or without a real need for it, unnecessary complicating the behavior, including resetting logic, utilizing excessive memory, and introducing unnecessary latencies
I guess they were once taught about propagation delays and pipelining as a measure of managing them, and since then try to make ad-hoc pipeline out of everything
still I find it lame and prefer to make everything combinational if possible, and only introduce extra memory if synthesis fails for given timing constraints

#HDL #VHDL #SystemVerilog #Verilog
stereophonic.spaceStereophonica
for #SystemRDL and similar languages there are (synthesisable) register block generators, having #AXI or AXI Lite on one end and a bunch on signals corresponding to the fields on another
similar generated blocks for parsing and forming AXI Stream should be a thing as well, turning an octet stream into a structure together with a validity and no-longer-needed signals, or vice versa

#HDL #VHDL #SystemVerilog #Verilog #HLS
stereophonic.spaceStereophonica
so far there's just one thing that drives me mad about #VHDL, or maybe specifically it's implementation in #Vivado:
if I name a component not exactly as the entity and forget to add corresponding configuration, it simply won't create the instance in the architecture and won't connect the signal, and issue no error whatsoever, just silently continue as if nothing happened
and then if I add the configuration, it still refuses to pick it up and doesn't create the instance :blobcatangry:
this ought to be a bug, should try it on #GHDL perhaps

in other respects it's pretty nice to write in, at first there are more, sometimes silly, errors (like you have gazillion of types which all are essentially a bit vector¹, and the type-checker will fuck with you if you aren't properly converting one into the other), and there are much fewer syntactic constructs than in #Verilog, let alone #SystemVerilog, that you're forced to wrap it all properly, but then, if it works, it works correctly, the way you intended
I pretty much want to try and use #Ada for a firmware, and I don't care if the tool-chain is proprietary (is #GNAT proprietary?) — the FLOSS enthusiasts should adopt better standards if they want me to use their stuff and contribute more

¹ boolean, bit, std_logic for single bit; arrays thereof; std_logic_vector, signed, unsigned, integer, natural, positive, time, and real are all mutually incompatible, modulo few exceptions
if-then-else only works with booleans, you can't just put a value of std_logic in place of the condition
stereophonic.spaceStereophonic
I still don't understand how delta-sigma modulation really works, what makes the pulses evenly distributed in time and not just lumped together as in pulse-width modulation
but I guess I've just found an algorithm for producing that same pattern without any feedback loops

we have
- a register with the desired value of pulses density, but the bits are in reverse order (LSB on the left)
- a counter, same width as the register, incremented on every clock cycle, overflowing without restrictions
- a combinatorial function deciding whether the output is high or low depending on the values in the registers

the combinatorial function
- determines by what power of two the counter is divisible in this clock cycle (where's the first 1, counting from LSB)
- the output is the value of the bit in corresponding position of the reversed register holding the density
- basically chained ("horizontal") OR of the counter, in every position AND NOT'd with the neighbouring bit, that's the mask to apply to the density register and then compare the result to zero

it's essentially like PWM but smoother
e.g. if the MSB of the density is high (the value in it is at least 1/2), every second clock cycle there will be a pulse
and if the LSB of the density is high (the value in it odd), one of the pulses will only be present in second half of the 2^width period

p.s. you can make the period be filled with up to 2^width-1 pulses, one will always be zero (the very first one corresponding to counter = 0)

#FPGA #ASIC #VHDL #SystemVerilog #Verilog
stereophonic.spaceStereophonic
they always say in digital electronics you only have zeros and ones — not quite: if you describe a differential line as a bit-vector of two elements, it's valid states are (0, 1) and (1, 0), the waveform viewer will show it to you as 1 and 2 respectively
speaking of differential lines, the often mentioned reason for their use is better noise tolerance, so you can use lower voltage for transmission and detect the signal with an opamp having the inverting and non-inverting inputs connected to the two wires
another reason why you might want to use differential signal internally is to avoid negation (extra inverters) at the expense of more wiring — each inverter on the signal's path adds a tiny but still extra delay and you might want to reduce that as much as possible if the path is critical enough

#FPGA #ASIC #VHDL #SystemVerilog #Verilog
stereophonic.spaceStereophonic
today I was wondering about how I'd describe a ring oscillator or a delay made of chained inverters in typical #VHDL or #SystemVerilog — that's not possible, AFAICT: the synthesiser will just optimise out the double negations by the LEM — and what should I use instead
also noticed that ternary arithmetic might come in handy to describe a signal which may be 0, 1, or -1, e.g. the output of a phase frequency detector or some other digital circuit where the high voltage may be as positive as negative — VHDL might accommodate that just fine as just another library
stereophonic.spaceStereophonic
today I've apparently found a bug in #Vivado — due to a combination of an interface with inout ports, driven from a class within the interface, which then gets overloaded by reassigning type value in a static property of another class (factory), the interface itself gets passed to module, then the values of a signal sampled on posedge within the module and outside of it became different and broke (AXI) handshaking
guess AMD should hire me already

the model I used was total shit just waiting to stab me in the back, I just couldn't find anything better and wanted to avoid implementing even AXI Lite by myself, then I searched again and found #TVIP #AXI which seems pretty solid so far

https://github.com/taichi-ishitani/tvip-axi

#Verilog #SystemVerilog
stereophonic.spaceStereophonic