I've tried several variations on this code, but never gotten compiled combinators with the expected behavior.
module priority(input clock, input [9:0] prevPriority, input [9:0] f, input complete, output [9:0] priority);
always @(posedge clock) begin
if (complete)
priority <= prevPriority;
else if (prevPriority > f)
priority <= prevPriority;
else
priority <= f;
end
endmodule
If the complete
input is set, this is supposed to output prevPriority
. If the complete
input is clear, this is supposed to output either f
or prevPriority
, whichever is larger.
The observed behavior is that copying f
to priority
works fine, but whenever it is supposed to output prevPriority
, it outputs 0 instead.
The blueprint from v2f is
0eNrtmN1umzAUx9/F16SKDYSAtN3sASbtojdVhAictJbARsZEiyLefTY0WUIDsVm2tspuKtnYx8f/3/lwukfrvIZSUCZRtEdUQoGikzkH5ckacjWnxlxQuVNTNOWsQtHTHlX0mSW53il3JahVrQEHsaTQowxSmoGYpbxYU5ZILlCjtrMMfqIIN85VA/ogmTB52QJpVg4CJqmk0PnTDnYxq4s1CHXEqCEHlbxSeznT5yt74YPvoB2KZvjBV6dkVEDaffYcbUEKnsdreEm2Sgq9Z0NzCWJAii0VslYzRx+6FbNHfYOU11rx+Ykaq3aase7MSlvC+o+A7PRuVI2w2pdSkdZUdmMtxLMAUK4+rZpGK9uTgthJgeefRYvAWgrXUgr8WaRYWEvhWUpBPrAUJ5c9UyV8o8pFKfyjFwVktC5mkKtzBE1nJc/hghbuuRamqYvP3SEnrrTfiTXExdHzRBXolwKkctoool0jhr+txupzRo933FBRydgOawXaRnwItxYwL0EknQvo+w+1j9eyrC0sf0NaGFMEbl/hHgFvlICDyM0qUTDWKYdrshm2V5O3Y2aDQ7tUlIlobxKhr0hPlLu4zep4I3gRU6YYo2iT5BXYI3+0Qr4YTzpyJSL8iRGxtI6IpXUuH4IC32UuB32whmRCazLh5Cr7fmTsMvaP0dnl5HIE3dnCt/V4BCx2rcnq17QlWnLXSYfNy+EQU4zNXmUY27VI99+3yNdud8CBe63vy3Drk6L+652v37vIldfOcBr2f3QavFxH8nSspY6aJUORQqZFCn63SJl/sEgh43zNiWGrgk2m2h2MBHdyq/bvsp6H5o+oQTaeYT337LKUWIG5gyxdGGeLe6Vc+1ZZio3P9Q2z1J8WCf87u8G/G67m5k1Ie5dIq9VbEFULhyyxF4QkcD0v8IjXNL8AqM1S6Q==
Here I have connected it to a 1/2 second clock, and set prevPriority
to 400 and f
to 350. The expected output in this case is 400, but the observed output is 0. I also tried 60 Hz (always-set) and 30 Hz clocks, with the same result.
0eNrtWcuOmzAU/RevyYiXDUFtN/MBlbqYTRUhAs6MJTDImKhRxL/XJp0kQ3jYkCZRp5soPHx9fc65D5s9WKcVLhihHAR7QOKcliD4uQcleaVRKu/xXYFBAAjHGTAAjTJ5leCYJJgt4jxbExrxnIHaAIQm+BcIrNoYNRAxwt8yzEncbcOuVwbAlBNO8MGj5mIX0ipbYyYmGfLFAEVeiqE5lQ4IcwvkLZ+gAXbir4OQmCchDMeHN1wDiHVzlqfhGr9FWyIsiGF/7IbiWdLYKuXdDWElDy9WtyWMV+LO0avDG4sXuSaJKo8kxI4pr7IiYo2fAfgiRuQVLyp9m8VOuFZRHm5YnoWEChsg4KzC9WFKelhf47UlfxhOzpEkSYNiTFhcEd5c2pK5s8eCBWHLVhtstQY77ceruj575Z1I+7i8d5g0mPSeoBKXG5JyzHqkPYJzJYmzztS9moxvHwbODDG7dxOz1dLy1ytreROl5SwxD4kX9lDhasvRP3Fh30qOrmlOFKRiVMI5UXkzGCaC4AxnPctUwwhpY+TdASMHTpWKqwaDpw0DelCpvDKM6QUMijncP86e4YRU2QKnwj4TDU6Rp7gTB9jGQZUZe7jyWugyE3a5vBxpx0aynanE3Mn0FYpPiaWN8FSDBK15gUUFalwA339MqEHPoK6nZ9CRHklRPTLnaHOBPjsX8IR9d+wiRfStCeh7j4C+DrBXoOdFi57lRaQY3Tx5wzHkK7Jo67bRUJfCq7TRzx/baPMvt9GaW0K/XUxsVRa7om2A1Ysipmq3r5xZ2tuoUzGD/o23UZPi94NOvt15u+W2heKOtNVQRx5LxZh3Z2VuRdr/tbqJ2tR4WpGruIe0oG48oo/E3CoDW4+VgTvw7cuMeryhqXZ7My6aXnFvmXEfnG84kjg95QpsjliydfTi989jK+rDm5EB0P+OrPcgpo8XOHIw4GvtXdHUeXv14M+r1uhznjj0H2wrV4Vactd8ggvOPvkZYItZ2SzE9i3XW9qe47smcs26/g3V+I5r
I suspect the issue is one of the C = 1 deciders; it has an input of C=351. I have reversed that decider (so it points up, instead of down) in the second blueprint. It is also very possible that I'm showing my lack of experience with verilog, but in that case, I don't know where to start debugging.
v2p is 97317fd0ec7358791967bb1b7a002746cad1abfb
, and yosys was built from d8c5d6815cc80af852ce0969e4cf775f44539c80
. Node is v14.17.0.