Sunday, 2019-11-24

*** tpb has joined #yosys00:00
*** rektide has joined #yosys00:12
*** dh73 has quit IRC01:14
*** kraiskil has quit IRC01:47
*** citypw has joined #yosys03:07
*** simeonm has joined #yosys04:16
*** rohitksingh has quit IRC04:38
*** rohitksingh has joined #yosys04:38
*** _whitelogger has quit IRC05:10
*** _whitelogger has joined #yosys05:15
*** whitequark has quit IRC05:25
*** whitequark has joined #yosys05:27
*** nrossi has joined #yosys05:27
*** _whitelogger has joined #yosys05:31
*** simeonm has quit IRC05:31
*** whitequark has quit IRC05:34
*** _whitelogger has quit IRC05:35
*** _whitelogger has joined #yosys05:40
*** _whitelogger has quit IRC05:40
*** simeonm has joined #yosys05:40
*** whitequark has joined #yosys05:56
*** _whitelogger has joined #yosys05:57
*** _whitelogger has quit IRC06:01
*** cr1901_modern has quit IRC06:06
*** cr1901_modern has joined #yosys06:07
*** _whitelogger has joined #yosys06:16
*** cr1901_modern has quit IRC06:51
*** cr1901_modern has joined #yosys06:54
*** m4ssi has joined #yosys07:21
*** m4ssi has quit IRC09:22
*** m4ssi has joined #yosys09:22
*** Jybz has joined #yosys09:40
*** rombik_su has joined #yosys09:56
*** rohitksingh has quit IRC10:08
*** m4ssi has quit IRC10:10
*** Jybz has quit IRC10:56
*** Jybz has joined #yosys10:59
*** Jybz has quit IRC11:28
lukegodaveshah: thanks for the twitter thread link11:34
*** Jybz has joined #yosys11:44
*** kraiskil has joined #yosys11:46
*** FSM_Dude has joined #yosys11:57
FSM_DudeHello!11:57
ZirconiumXHiya11:58
*** kraiskil has quit IRC12:01
*** kraiskil has joined #yosys12:02
FSM_DudeI just synthesised a design and written it back to a verilog file using Yosys' `write_verilog` function. In the generated verilog file I see the selected cells from the cell library I used.12:02
FSM_DudeWould it be possible for me to create new cell with the same input and output as the selected cells, and then replace the selected cell with my new cell?12:03
ZirconiumXFSM_Dude: Depending on your requirements, techmap could do that12:08
FSM_DudeOkay, Ive written a TMR Flip Flop design in verilog. I'd like to synthesise that, and replace all Flip Flops in another design by those TMR Flip Flops12:09
ZirconiumXFSM_Dude: ...why did you have to bring up flip-flops?12:13
ZirconiumXThey are amongst the most painful parts of Yosys at the moment12:13
FSM_DudeIm interested in the differences between using normal flips-flops vs TMR flip-flops12:14
ZirconiumXBut yeah, you'd use techmap12:14
FSM_DudeCool, Im gonna read some about `techmap`12:14
FSM_DudeThanks a lot!12:14
ZirconiumXYou'll want to use Yosys' internal documentation rather than the stuff on Clifford's website, as it's generally more up to date12:15
FSM_DudeOkay, I'll build the documentation then:) thanks again!12:17
*** FSM_Dude has quit IRC12:41
*** Jybz has quit IRC12:52
*** Jybz has joined #yosys12:56
*** FSM_Dude has joined #yosys13:12
*** Jybz has quit IRC13:22
*** Jybz has joined #yosys13:22
FSM_Dude`(* techmap_simplemap *)(* techmap_celltype = "$sr $ff $dff $dffe $adff $dffsr $dlatch" *)module _90_simplemap_registers;endmodule`13:24
FSM_Dudewoops*13:24
*** FSM_Dude30 has joined #yosys13:43
*** FSM_Dude has quit IRC13:44
*** FSM_Dude has joined #yosys13:51
*** FSM_Dude has quit IRC14:00
pepijndevosIt seems that Yosys does not have a remainder operator, as present in VHDL. How does this work in Verific?16:16
pepijndevosIs that something that could be added?16:16
whitequarkyou probably want a new cell16:16
whitequarki imagine you want a new cell for division too16:16
whitequark(I assume VHDL uses quo/rem, in contrast to Verilog's div/mod)16:17
pepijndevosWhy division? Are $div semantics diffrent than VHDL division?16:17
pepijndevosVHDL has both mod and rem operators16:18
whitequarkhm16:18
whitequarktry dividing by a negative number in both verilog and vhdl and compare the result16:18
pepijndevosI would not be surprised if Verilog is one of those cursed languages that has only modulus that is actually remainder but is still called modulus.16:20
whitequarkhang on, i had a handy table somewhere16:20
whitequarkhm16:21
whitequarkhttps://en.wikipedia.org/wiki/Modulo_operation#In_programming_languages16:22
tpbTitle: Modulo operation - Wikipedia (at en.wikipedia.org)16:22
*** citypw has quit IRC16:23
whitequarkpepijndevos: yeah so I think the $mod cell in Yosys actually corresponds to the rem operation in VHDL16:23
pepijndevosYea, just what I thought...16:24
pepijndevos*facepalm*16:24
whitequarkit... should be renamed I think16:24
pepijndevosIt'd be great if we could stop propagating C errors16:24
whitequarkanyway, this is why nmigen actually prohibits signed division/modulo operations16:24
whitequarkpython's % also has the remainder semantics16:25
whitequarkand it's also called __mod__ of course16:25
pepijndevos*prohibits* haha16:26
whitequarkthat lets me avoid adding new yosys cells16:28
pepijndevosshould I make a yosys issue for this?16:31
pepijndevosToo late to prohibit signed modulus in VHDL now ;)16:31
whitequarkan issue, sure, but I expect that if you want this cell you'll have to implement it yourself16:36
pepijndevosProbably... and I don't think I care about signed modulus enough to do this. I guess GHDL will just throw an error...16:38
pepijndevosI'm going to try and see what verific does...16:40
emily+1 to not propagating C errors16:40
emilythe worst part is that it means hardware implements the mathematically less useful one16:40
emilybecause of C16:40
whitequarkinteger or floating-point16:42
pepijndevosDOHHH!! Verific does the wrong thing and just makes a $mod cell for both mod and rem16:47
emilywhitequark: I forget, but I think integer at least16:48
emilypepijndevos: :(((((16:48
whitequarklol16:49
daveshahI suspect this is a bug in the Yosys Verific integration16:51
daveshahhttps://github.com/YosysHQ/yosys/blob/master/frontends/verific/verific.cc#L48416:52
tpbTitle: yosys/verific.cc at master · YosysHQ/yosys · GitHub (at github.com)16:52
pepijndevosyep16:59
emilyso much for "verif"16:59
pepijndevosWell, to be fair, can't blame verific in this case.17:02
pepijndevoshttps://github.com/YosysHQ/yosys/issues/152317:09
tpbTitle: Yosys modulus operator has remainder semantics · Issue #1523 · YosysHQ/yosys · GitHub (at github.com)17:09
*** emeb has joined #yosys17:22
pepijndevoswhelp, I didn't actually remember which way Python % works... apparently *not* the same as verilog17:22
whitequarker, i'm wrong17:23
whitequarkpython's % is actually modulo17:23
whitequarkthe issue with division was something else, um17:23
pepijndevosVerilog % is sign of dividend, Python % is sign of divisor17:24
pepijndevosYea, so python is modulo, verilog is remainder17:24
whitequarkthe sign of the result of division in python is xor of the signs of operands17:25
pepijndevosThat's just... how math works, no?17:28
whitequarkyes17:28
whitequarkso i'm trying to remember where it doesn't match verilog17:28
whitequarkthere was something but i forgot :(17:29
pepijndevosdivide by zero?17:29
whitequarkno, nmigen defines that, so i emit a mux17:29
whitequark(x/0=0)17:29
* pepijndevos screams in math17:30
whitequarkyou'll be delighted that coq also defines division by zero to return zero17:30
whitequarkand you can't really argue that it wasn't written by, well, mathematicians17:31
whitequark*to learn that17:31
whitequarkfor the same reasons too: it would be silly to return an Option<T> in that case, and using an exception wouldn't be good too, and you have perfectly good formal verification tools right in your toolkit17:32
whitequarkoh of course17:32
whitequarkPython division truncates towards -inf, Verilog division truncates towards zero17:32
pepijndevosah yea i was about to suggest that17:32
whitequarkwhich one does Verilog have?17:33
whitequarker17:33
whitequarkVHDL17:33
pepijndevosI'm scared to look17:33
pepijndevosProbably the one Verilog doesn't have, leading to another bug17:33
ZirconiumXI just dragged out the VHDL 2008 spec17:35
ZirconiumXI can't into maths, so I'm hoping somebody can recognise it17:35
ZirconiumXIEEEStd 1076-2008IEEE STANDARD VHDL LANGUAGE REFERENCE MANUAL128Copyright © 2009 IEEE. All rights reserved.Integer division and remainder are defined by the following relation:A = (A/B) * B + (A rem B)17:35
ZirconiumX...Thanks17:35
whitequarkdo you have a link to the pdf?17:36
ZirconiumXhttps://pastebin.com/7GFEvCmt17:37
tpbTitle: Integer division and remainder are defined by the following relation: A = (A - Pastebin.com (at pastebin.com)17:37
pepijndevosSo how do you hanldle division by negative numbers in nMigen17:37
ZirconiumXwhitequark: ftp://ftp.lpp.polytechnique.fr/jeandet/keep/sync/vhdl/4772740_IEEE-1076_Standard-VHDL-Language-Ref-Manual.pdf17:38
whitequarkpepijndevos: it is a compile time error to use a signed number on the right hand side of % or // operator17:38
pepijndevosI see17:38
whitequarksometimes, the best way to deal with a hard problem is avoidance :)17:38
OK_b00m3r:)17:39
pepijndevosSo only division by a constant?17:39
OK_b00m3rwhitequark: may i OH that17:39
OK_b00m3rwith ur nick17:39
*** fsasm has joined #yosys17:40
whitequarkI guess?17:40
whitequarkpepijndevos: no. nmigen has signed and unsigned values, which are separate types17:40
pepijndevosah ofc17:40
whitequark(all values in nmigen have integer type with two properties: width and signedness)17:40
pepijndevosOkay, I think... VHDL does it the Verilog way, and round to zero17:48
pepijndevosah wait...17:48
pepijndevosso confusing for my sleepy brain17:48
pepijndevosAt least I'm pretty sure that equation ZirconiumX posted does not hold in Python17:51
pepijndevosTherefore I assume VHDL does the right thing (for DSP quantization error) and round to zero.17:52
pepijndevosOr not...17:52
pepijndevosActually... well, never mind...17:53
whitequarkhm, let's say A=-10, B=3, A rem B=-1, -10=(A/B)*3-1, A/B=-317:53
whitequarkthat seems to imply round towards zero17:53
pepijndevoshurray17:54
pepijndevosStill thinking about the DSP part... I remember that some ADC designer truncated LSB rather than rounding properly, creating some horrible cross-over distortion. But I'm not awake enough to figure out which division scheme would be worse.17:56
*** fsasm has quit IRC18:14
*** X-Scale` has joined #yosys18:14
*** X-Scale has quit IRC18:14
*** fsasm has joined #yosys18:14
*** X-Scale` is now known as X-Scale18:15
*** Jybz has quit IRC19:10
*** Jybz has joined #yosys19:10
*** X-Scale has quit IRC19:47
*** X-Scale` has joined #yosys19:47
*** X-Scale` is now known as X-Scale19:48
*** Laksen has joined #yosys20:08
*** fsasm has joined #yosys20:20
*** nrossi has quit IRC20:46
*** kraiskil has quit IRC21:03
*** rombik_su has quit IRC21:04
*** rombik_su has joined #yosys21:06
*** Laksen has quit IRC21:13
*** fsasm has quit IRC21:32
*** rohitksingh has joined #yosys21:59
*** zino has joined #yosys22:08
*** zino has left #yosys22:09
*** Jybz has quit IRC22:13
*** emeb has quit IRC23:47
*** rombik_su has quit IRC23:56

Generated by irclog2html.py 2.13.1 by Marius Gedminas - find it at mg.pov.lt!