{"id":464957,"date":"2025-06-28T15:00:23","date_gmt":"2025-06-28T15:00:23","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=464957"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=464957","title":{"rendered":"<span>\u041f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440 \u043d\u0430 \u043a\u043e\u043b\u0435\u043d\u043a\u0435 \u0447.3. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0431\u044b\u0441\u0442\u0440\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/span>"},"content":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nw\/qv\/w6\/nwqvw6oq0dhgsnufm0kfiequi5s.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/nw\/qv\/w6\/nwqvw6oq0dhgsnufm0kfiequi5s.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/nw\/qv\/w6\/nwqvw6oq0dhgsnufm0kfiequi5s.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044e, \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0432\u0443\u0445 \u043d\u0435\u0434\u0435\u043b\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0435. \u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u043d\u043e \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0441\u0442.<br \/> <a name=\"habracut\"><\/a> <\/p>\n<h4>\u0421\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0435 \u0440\u0435\u0448\u0435\u043d\u0438\u044f<\/h4>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0442\u0430\u043c \u0443 \u0444\u043b\u0430\u0433\u043c\u0430\u043d\u043e\u0432.<br \/> Intel \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 SRT Radix-4 \u0438\u043b\u0438 16, \u0442\u0430\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c, \u0441\u0430\u043c\u0438 \u0447\u0438\u0441\u043b\u0430 \u0440\u0430\u0437\u0431\u0438\u0442\u044b \u043d\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u044b \u043f\u043e \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0442, \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043c\u043e\u0436\u0435\u0442 \u0432\u044b\u0445\u043e\u0434\u0438\u0442\u044c \u0437\u0430 \u043f\u0440\u0435\u0434\u0435\u043b\u044b \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430, \u043f\u043e\u0442\u043e\u043c \u044d\u0442\u0438 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442\u044b \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u0443\u044e\u0442\u0441\u044f \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435 \u0434\u0432\u043e\u0438\u0447\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<br \/> AMD \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u0442 \u043c\u0435\u0442\u043e\u0434 \u0413\u043e\u043b\u044c\u0434\u0448\u043c\u0438\u0442\u0430 \u0441 \u0438\u0442\u0435\u0440\u0430\u0442\u0438\u0432\u043d\u044b\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435\u043c 1\/x \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u043c \u0434\u043e\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435\u043c \u043d\u0430 \u0434\u0435\u043b\u0438\u043c\u043e\u0435.<\/p>\n<h4>\u041f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u0434\u0435\u043b\u0435\u043d\u0438\u044f<\/h4>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0434\u0430\u0432\u0430\u0439\u0442\u0435 \u0440\u0430\u0437\u0431\u0438\u0440\u0430\u0442\u044c\u0441\u044f, \u0447\u0435\u043c \u0442\u0430\u043a \u043f\u043b\u043e\u0445\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u043f\u043e\u0447\u0435\u043c\u0443 \u043e\u0442\u043d\u0438\u043c\u0430\u0435\u0442 \u043c\u043d\u043e\u0433\u043e \u0442\u0430\u043a\u0442\u043e\u0432. \u041e\u0441\u043d\u043e\u0432\u043d\u0430\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u043e\u0434\u0431\u043e\u0440 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0441\u0430\u043c\u043e\u0433\u043e \u0437\u043d\u0430\u0447\u0430\u0449\u0435\u0433\u043e \u0431\u0438\u0442\u0430, \u043d\u043e \u043f\u043e\u0442\u043e\u043c \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435. \u0410 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435, \u043a\u0430\u043a \u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0430\u0449\u0435\u0433\u043e \u0431\u0438\u0442\u0430. \u0418 \u0435\u0441\u043b\u0438 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u0441\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u0430 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442, \u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043e\u0434\u043d\u043e\u0431\u0438\u0442\u043d\u044b\u0445 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u043e\u0432 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u044d\u043a\u0432\u0438\u0432\u0430\u043b\u0435\u043d\u0442\u043d\u043e\u0439 n^2, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u0441\u0438\u0433\u043d\u0430\u043b \u0431\u0443\u0434\u0435\u0442 \u043f\u043e\u0441\u0442\u043e\u044f\u043d\u043d\u043e \u043d\u0430\u043c\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u043a\u0440\u0443\u0433\u0438 \u043e\u0442 \u043d\u0430\u0438\u043c\u0435\u043d\u0435\u0435 \u0437\u043d\u0430\u0447\u0430\u0449\u0435\u0433\u043e \u0431\u0438\u0442\u0430 \u043a \u043d\u0430\u0438\u0431\u043e\u043b\u0435\u0435 \u0437\u043d\u0430\u0447\u0430\u0449\u0435\u043c\u0443, \u0447\u0442\u043e\u0431\u044b \u0432 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437 \u0441\u0440\u0430\u0432\u043d\u0438\u0442\u044c \u0438 \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438. \u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u043a\u0430\u043a \u0440\u0435\u0448\u0430\u0435\u0442\u0441\u044f \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0432 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u0445.<\/p>\n<h4>\u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f<\/h4>\n<p> \u041d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u043c\u0435\u0442\u043e\u0434 \u0413\u043e\u043b\u044c\u0434\u0448\u043c\u0438\u0442\u0430, \u043a\u0430\u043a \u0438 \u0435\u0433\u043e \u0441\u043e\u0441\u0435\u0434 \u2014 \u043c\u0435\u0442\u043e\u0434 \u041d\u044c\u044e\u0442\u043e\u043d\u0430-\u0420\u0430\u0444\u0441\u043e\u043d\u0430, \u0432\u044b\u0442\u0435\u043a\u0430\u0435\u0442 \u0438\u0437 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c. \u041f\u043e\u0434\u0440\u043e\u0431\u043d\u043e \u043e\u0431\u044a\u044f\u0441\u043d\u044f\u0442\u044c \u0438\u0445 \u043d\u0435 \u0431\u0443\u0434\u0443, \u0432 <a href=\"https:\/\/ru.wikipedia.org\/wiki\/%D0%90%D0%BB%D0%B3%D0%BE%D1%80%D0%B8%D1%82%D0%BC_%D0%B4%D0%B5%D0%BB%D0%B5%D0%BD%D0%B8%D1%8F\" rel=\"nofollow noopener noreferrer\">\u0412\u0438\u043a\u0438\u043f\u0435\u0434\u0438\u0438<\/a> \u0432\u0441\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u043e\u043d\u044f\u0442\u043d\u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043e, \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0443\u0436\u043d\u044b\u0435 \u0438\u0434\u0435\u0438 \u0438\u0437 \u044d\u0442\u0438\u0445 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u043e\u0432.<\/p>\n<h4>\u0411\u0430\u0437\u043e\u0432\u0430\u044f \u0438\u0434\u0435\u044f \u043c\u0435\u0442\u043e\u0434\u0430 \u041d\u044c\u044e\u0442\u043e\u043d\u0430<\/h4>\n<p> \u0421\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0435\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 1\/y, \u043f\u043e\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 x (\u043e\u043d \u0436\u0435 \u0434\u0435\u043b\u0438\u043c\u043e\u0435), \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0430\u0441\u0442\u043d\u043e\u0435 q, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e. \u041f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0435\u0433\u043e \u043d\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0437 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e. \u041f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043e\u0441\u0442\u0430\u0442\u043e\u043a (\u043f\u043e\u043a\u0430 \u0432\u0441\u0451 \u043a\u0430\u043a \u0432 \u043e\u0431\u044b\u0447\u043d\u043e\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0438 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a, \u0442\u043e\u043b\u044c\u043a\u043e \u0447\u0438\u0441\u043b\u043e \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c\u044b\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0437\u0430 \u0440\u0430\u0437 \u043e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u043c). \u041f\u043e\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0434\u043e\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043d\u0430 \u0442\u043e\u0442 \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0441\u043e\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c, \u043e\u043f\u044f\u0442\u044c \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u043d\u0435\u043a\u0438\u0439 \u043a\u0443\u0441\u043e\u0447\u0435\u043a \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0437 \u043e\u0441\u0442\u0430\u0442\u043a\u0430, \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0432 \u043d\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u0438 \u0442.\u0434.<br \/> \u041d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u043c\u0435\u043d\u0442\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u0434\u043e\u0431\u0440\u0430\u0442\u044c \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 \u0441 \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c\u044e 8 \u0431\u0438\u0442, \u0442\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043d\u0430 8 \u0431\u0438\u0442, \u0438 \u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c \u043d\u043e\u0432\u044b\u0435 8 \u0431\u0438\u0442 \u0437\u0430 \u0442\u0430\u043a\u0442. \u041d\u0435\u043f\u043b\u043e\u0445\u043e\u0439 \u043a\u043e\u043c\u043f\u0440\u043e\u043c\u0438\u0441\u0441 \u043c\u0435\u0436\u0434\u0443 \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c\u044e \u0438 \u0440\u0430\u0437\u043c\u0435\u0440\u043e\u043c \u043d\u0430 \u043a\u0440\u0438\u0441\u0442\u0430\u043b\u043b\u0435.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434 \u041d\u044c\u044e\u0442\u043e\u043d\u0430<\/h4>\n<p> \u0415\u0441\u043b\u0438 \u0432\u0437\u044f\u0442\u044c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e 1.0 \u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441, \u043d\u0435 \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 y, \u0442\u043e \u043f\u043e\u0441\u043b\u0435 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u0438\u0437 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c, \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u043d\u0430 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442. \u0415\u0441\u043b\u0438 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0440\u0430\u0437\u0443 \u0432\u0437\u044f\u0442\u044c \u044d\u0442\u043e\u0442 \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u0447\u043d\u044b\u0439 \u043a\u043e\u044d\u0444\u0444\u0438\u0446\u0438\u0435\u043d\u0442 (\u043e\u043d \u0436\u0435 \u0447\u0430\u0441\u0442\u043d\u043e\u0435), \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f, \u0447\u0442\u043e \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0440\u0430\u0441\u0442\u0451\u0442 \u043d\u0430\u043c\u043d\u043e\u0433\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435, \u0447\u0438\u0441\u043b\u043e \u0432\u0435\u0440\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u0443\u0434\u0432\u0430\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0430 \u043d\u0435 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043d\u0430 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0443. \u041d\u0430 \u044d\u0442\u043e \u0447\u0438\u0441\u043b\u043e \u0432\u0435\u0440\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u043d\u0438\u043c\u0430\u0442\u0435\u043b\u044c\u043d\u0435\u0435. \u0415\u0441\u043b\u0438 \u0432 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435 \u0447\u0438\u0441\u043b\u043e \u0442\u0438\u043f\u0430 1.0000xxx&#8230;, \u0442\u043e \u0432\u0435\u0434\u0443\u0449\u0438\u0435 \u043d\u0443\u043b\u0438 \u0438 \u043e\u0437\u043d\u0430\u0447\u0430\u044e\u0442 \u0447\u0438\u0441\u043b\u043e \u0432\u0435\u0440\u043d\u044b\u0445 \u0431\u0438\u0442\u043e\u0432 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435. \u041f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0432 \u0434\u0435\u043b\u0438\u043c\u043e\u043c \u0435\u0434\u0438\u043d\u0438\u0446\u0430, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u043f\u043e\u0434\u0431\u043e\u0440 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442 \u0432\u0441\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0441 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u0435\u043c \u0432 0 (\u043d\u0443 \u0438\u043b\u0438 \u0432 1, \u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0440\u0430\u0437\u043d\u0438\u0446\u044b \u043d\u0435\u0442, \u0442\u0430\u043a \u043a\u0430\u043a 1111 + 1 = 10000).<br \/> \u0412\u0441\u0451 \u0431\u044b \u0445\u043e\u0440\u043e\u0448\u043e, \u043d\u043e \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043f\u0440\u0438\u0445\u043e\u0434\u0438\u0442\u0441\u044f \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043d\u0430 1\/y, \u0430 \u043f\u043e\u0442\u043e\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043d\u0430 \u0447\u0430\u0441\u0442\u043d\u043e\u0435, \u0447\u0442\u043e \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0443\u0432\u0435\u043b\u0438\u0447\u0435\u043d\u0438\u044e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0434\u043d\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438.<\/p>\n<h4>\u041c\u0435\u0442\u043e\u0434 \u0413\u043e\u043b\u044c\u0434\u0448\u043c\u0438\u0442\u0430<\/h4>\n<p> \u0420\u0430\u0437\u0432\u0438\u0442\u0438\u0435 \u0438\u0434\u0435\u0438 \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0443\u0436 \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0438\u0442\u044c\u0441\u044f \u0441\u043f\u043b\u043e\u0448\u043d\u044b\u0445 1 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435, \u0442\u043e \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u0434\u0435\u043b\u0430\u0442\u044c \u044d\u0442\u043e \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435, \u0443\u043c\u043d\u043e\u0436\u0430\u044f \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u0438 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u043d\u0430 \u043e\u0434\u043d\u043e \u0438 \u0442\u043e \u0436\u0435 \u0447\u0438\u0441\u043b\u043e. \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 0 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0441\u043e\u0432\u0441\u0435\u043c \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u043e.<br \/> 100ab\u2026<br \/> -__100ab\u2026 * a<br \/> -___100ab\u2026 * b<br \/> \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u044b \u0441 \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u043c\u0438 \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u043b\u044f \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0431\u0438\u0442\u044b \u043c\u043e\u0436\u043d\u043e \u0431\u0440\u0430\u0442\u044c \u043d\u0430\u043f\u0440\u044f\u043c\u0443\u044e \u0438\u0437 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c y_next = y \u2014 y*000ab), \u0440\u0430\u0437\u0432\u0435 \u0447\u0442\u043e \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0438\u0437 \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u0442\u044c \u043e\u0434\u0438\u043d \u043f\u0435\u0440\u0435\u043d\u043e\u0441.<\/p>\n<p> \u0415\u0441\u043b\u0438 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c 1, \u0442\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435\u043e\u0447\u0435\u0432\u0438\u0434\u043d\u043e.<br \/> 111ab\u2026<br \/> +__111ab\u2026 * (1-a)<br \/> +___111ab\u2026 * (1-b)<br \/> \u0417\u0434\u0435\u0441\u044c \u043c\u044b \u043a\u0430\u043a \u0431\u044b \u0441\u0447\u0438\u0442\u0430\u0435\u043c, \u0447\u0442\u043e 111 \u044d\u0442\u043e 1 000 -1, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043a\u0443 \u0432\u043f\u0440\u0430\u0432\u043e \u043d\u0430 1.<\/p>\n<h4>\u041d\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c<\/h4>\n<p> \u041d\u0430\u0445\u043e\u0434\u0438\u0442\u044c 1\/x, \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435\u043c, \u0437\u0430\u043f\u043e\u043b\u043d\u044f\u0442\u044c \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438, \u0437\u0430\u043f\u0438\u0441\u044b\u0432\u0430\u0442\u044c \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u044b \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0442\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u043f\u043e\u043c\u0435\u0441\u0442\u0438\u0442\u044c\u0441\u044f, \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0442\u044c \u0431\u0438\u0442\u044b \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u043e\u043d\u0438 \u043d\u0435 \u043f\u0435\u0440\u0435\u0441\u0435\u043a\u0430\u044e\u0442\u0441\u044f \u2014 \u0432\u0441\u0451 \u044d\u0442\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043d\u043e\u0432\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435.<br \/> \u0420\u0430\u0437 \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u043c\u0435\u0442\u043e\u0434\u0430\u043c \u043c\u043e\u0436\u043d\u043e \u043d\u0430\u0447\u0438\u043d\u0430\u0442\u044c \u0441 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a, \u0442\u043e \u0438 \u043c\u044b \u043d\u0430\u0447\u043d\u0451\u043c. \u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0435\u0441\u0442\u044c \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c 1.000\u2026 \u0438 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c 0.1\u0445\u0445\u0445\u2026. \u0411\u0443\u0434\u0435\u043c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u0431\u0438\u0442\u044b \u0434\u043b\u044f \u0438\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044f \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0438\u0445 \u043a \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044e. \u0418\u0434\u0435\u044f \u0441\u043e\u0441\u0442\u043e\u0438\u0442 \u0432 \u0442\u043e\u043c, \u0447\u0442\u043e \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u043c\u0435\u043d\u0442 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0431\u0438\u0442\u0430, \u0438 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u043b\u0438\u043d\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u0431\u0438\u0442\u043e\u0432 \u0432 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u0445 \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0440\u0430\u0432\u043d\u0430 n.<br \/> __0.1xxx\u2026<br \/> +_0.01xxx\u2026<br \/> \u0415\u0441\u043b\u0438 \u043f\u0435\u0440\u0432\u044b\u0439 \u0431\u0438\u0442 \u043f\u043e\u0441\u043b\u0435 1 \u0440\u0430\u0432\u0435\u043d 0 (\u0442.\u0435. 0.10xx&#8230;), \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044e \u0431\u0438\u0442, \u0430 \u043a \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044e x&gt;&gt;1. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u043f\u043e\u0441\u043b\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0439.<br \/> __0.1xxx\u2026<br \/> +\u2026<br \/> +_____0.1[xxx.]\u2026<br \/> +______0.[1xxx]\u2026<br \/> \u0422\u0443\u0442 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u0438 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0438 \u043c\u043e\u0433\u0443\u0442 \u0434\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0438 \u043d\u0435 \u043e\u0434\u0438\u043d. \u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043e\u0448\u0438\u0431\u0438\u0442\u044c\u0441\u044f, \u043d\u0430\u0434\u043e \u0431\u0440\u0430\u0442\u044c \u0448\u0438\u0440\u0438\u043d\u0443 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c\u043e\u0433\u043e \u043e\u043a\u043d\u0430 \u043d\u0435 1 \u0431\u0438\u0442, \u0430 log(n). \u041d\u043e \u0442\u043e\u0433\u0434\u0430 \u043a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0431\u0438\u0442 \u0431\u0443\u0434\u0435\u0442 \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0432\u0430\u0442\u044c \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043d\u0430 log(n), \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0434\u0430\u0441\u0442 n*log(n) \u0434\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430, \u0430 \u044d\u0442\u043e \u043d\u0438\u0447\u0435\u043c \u043d\u0435 \u043b\u0443\u0447\u0448\u0435 \u043e\u0431\u044b\u0447\u043d\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c, \u0435\u0441\u043b\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u043d\u044b\u0435 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u044b. \u041a \u0442\u043e\u043c\u0443 \u0436\u0435 \u0440\u0430\u0437\u043c\u0435\u0440 \u043b\u043e\u0433\u0438\u043a\u0438 \u0440\u0430\u0437\u0440\u0430\u0441\u0442\u0451\u0442\u0441\u044f \u0438 \u0437\u0430\u0439\u043c\u0451\u0442 \u043c\u0435\u0441\u0442\u043e \u043d\u0430 \u0447\u0438\u043f\u0435.<\/p>\n<h4>\u0418\u0437\u0431\u0430\u0432\u043b\u044f\u0435\u043c\u0441\u044f \u043e\u0442 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u0432<\/h4>\n<p> \u0427\u0442\u043e \u0432\u043e\u043e\u0431\u0449\u0435 \u043c\u0435\u0448\u0430\u0435\u0442 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e? \u0421\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043f\u0435\u0440\u0432\u0443\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c, \u0438\u0437-\u0437\u0430 \u043d\u0438\u0445 \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0434\u043b\u0438\u043d\u043d\u043e\u0439. \u0410 \u0432\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0438\u0437 \u0434\u0435\u0431\u0440\u0435\u0439 \u043c\u0430\u043b\u0435\u043d\u044c\u043a\u0438\u0445 \u0431\u0438\u0442\u043e\u0432 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043b\u0435\u0442\u0435\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0438\u0441\u043f\u043e\u0440\u0442\u0438\u0442 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442. \u041e\u0431\u0435 \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u044b \u043c\u043e\u0436\u043d\u043e \u0438\u0441\u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0440\u0430\u0437\u043e\u043c, \u0435\u0441\u043b\u0438 \u0440\u0430\u0437\u0440\u0435\u0448\u0438\u0442\u044c \u0432 \u043a\u0430\u0436\u0434\u043e\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0435, \u0447\u0435\u043c \u0442\u0430\u043c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c. \u041f\u0443\u0441\u0442\u044c \u0443 \u043d\u0430\u0441 \u0432\u0441\u0451 \u0442\u0430\u043a \u0436\u0435 \u0440\u0430\u0437\u0440\u044f\u0434 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 (0 \u0438\u043b\u0438 1) * 2^n, \u043d\u043e \u0432\u043c\u0435\u0441\u0442\u043e 0,1 \u0442\u0430\u043c \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c 0,1,2,3. \u0421\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u0432 \u0442\u0430\u043a\u043e\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0432 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434, \u0442\u043e \u0435\u0441\u0442\u044c \u043c\u044b \u043a\u0430\u043a \u0431\u044b \u0440\u0430\u0437\u0440\u044b\u0432\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u0430 \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u044d\u0442\u0430\u043f.<br \/> \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440 \u0441 \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u043d\u043d\u044b\u043c\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430\u043c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/712892\/\">habr.com\/ru\/articles\/712892<\/a>.<br \/> \u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0434\u0438\u0444\u0438\u0446\u0438\u0440\u0443\u0435\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c, \u0447\u0442\u043e\u0431\u044b \u043d\u0438\u0447\u0435\u0433\u043e \u043d\u0435 \u0442\u043e\u0440\u043c\u043e\u0437\u0438\u043b\u043e. \u041d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u043e\u0441\u0432\u043e\u0431\u043e\u0436\u0434\u0430\u0435\u043c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u0430, \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044f \u0435\u0433\u043e \u0432\u043b\u0435\u0432\u043e. \u0412 \u0438\u0442\u043e\u0433\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u043e\u0442 0 \u0434\u043e 2. \u041f\u043e\u0442\u043e\u043c \u043a \u044d\u0442\u043e\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u043e\u0435 \u0441\u043b\u0430\u0433\u0430\u0435\u043c\u043e\u0435.<br \/> \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0435\u0441\u043b\u0438 \u0432 \u043a\u0430\u043a\u043e\u0439-\u0442\u043e \u043c\u043e\u043c\u0435\u043d\u0442 \u043e\u0431\u0440\u0430\u0437\u0443\u0435\u0442\u0441\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 1 1 1 2, \u0442\u043e \u043d\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c \u044d\u0442\u0430\u043f\u0435 \u043e\u043d\u0430 \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u0441\u044f \u0432 1 1 2 0, \u0442\u043e \u0435\u0441\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043f\u043e\u043d\u0435\u043c\u043d\u043e\u0433\u0443 \u0434\u0432\u0438\u0433\u0430\u0435\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u043b\u0435\u0432\u043e. \u0412 \u044d\u0442\u043e\u0442 \u043c\u043e\u043c\u0435\u043d\u0442 \u043c\u044b \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0445\u043e\u0436\u0435\u0435 \u043d\u0430 \u043a\u0440\u0430\u0448-\u0442\u0435\u0441\u0442 \u0430\u0432\u0442\u043e\u043c\u043e\u0431\u0438\u043b\u044f. \u041a\u043e\u0433\u0434\u0430 \u0432 \u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u043d\u0430\u0431\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 3, \u043c\u044b \u0435\u0433\u043e \u0437\u0430\u043c\u043e\u0440\u0430\u0436\u0438\u0432\u0430\u0435\u043c \u0438 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u043c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u043c\u0443 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e. \u041f\u043e\u043a\u0430 \u0447\u0442\u043e \u0434\u043b\u0438\u043d\u0430 \u0446\u0435\u043f\u043e\u0447\u043a\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0440\u0430\u0432\u043d\u043e\u0439 \u043e\u0434\u043d\u043e\u043c\u0443 \u043e\u0434\u043d\u043e\u0431\u0438\u0442\u043d\u043e\u043c\u0443 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u0443 \u0437\u0430 \u0441\u0447\u0451\u0442 \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u0430.<br \/> \u0412 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c 0.1xxx\u2026 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 0.1333&#8230;, \u0430 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c 1.000\u2026 \u0432 1.2313\u2026. \u041a\u0430\u0436\u0434\u044b\u0439 \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442 \u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u043b\u043e\u0433\u0438\u043a\u0438 1 \u043e\u0434\u043d\u043e\u0431\u0438\u0442\u043d\u044b\u0439 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440 \u0438 \u043b\u043e\u0433\u0438\u043a\u0443 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430. \u0421\u0435\u0439\u0447\u0430\u0441 \u0441 \u043d\u0435\u0439 \u0440\u0430\u0437\u0431\u0435\u0440\u0451\u043c\u0441\u044f. \u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0432 \u0441\u0442\u0430\u0440\u0448\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 3, \u043d\u0430\u0434\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u043d\u0435\u043c\u0443 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u043f\u0430\u0440\u0443 \u0440\u0430\u0437, \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0441\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u043c.<br \/> 0.13331\u2026<br \/> +___0.1xxx<br \/> \u0422\u0443\u0442 \u0432\u0430\u0436\u043d\u043e \u043f\u043e\u043c\u043d\u0438\u0442\u044c, \u0447\u0442\u043e \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0434\u0435\u043b\u0430\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f 3 + 1 = 0. \u0418\u0442\u043e\u0433\u043e\u0432\u0430\u044f \u043b\u043e\u0433\u0438\u043a\u0430 \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0430\u044f: <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u0443\u0436\u0435 3, \u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0434\u0430\u043b\u044c\u0448\u0435 \u0431\u0435\u0437 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430<\/li>\n<li>\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0441\u0443\u043c\u043c\u0443 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430<\/li>\n<li>\u0435\u0441\u043b\u0438 3, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c 0<\/li>\n<li>\u0435\u0441\u043b\u0438 2, \u0442\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c 1 (\u044d\u0442\u043e \u043d\u0435\u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0432\u0435\u0442\u043a\u0430, \u043d\u0430 \u043f\u0435\u0440\u0432\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442)<\/li>\n<li>\u0435\u0441\u043b\u0438 1, \u0442\u043e 1 \u0440\u0430\u0437\u0440\u044f\u0434<\/li>\n<li>\u0435\u0441\u043b\u0438 0, \u0442\u043e 2 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 (\u0442\u043e \u0435\u0441\u0442\u044c x&lt;&lt;1)<\/li>\n<\/ul>\n<p> \u043d\u0430 \u0432\u0442\u043e\u0440\u043e\u043c \u044d\u0442\u0430\u043f\u0435 <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u0441\u0443\u043c\u043c\u0430 3, \u0442\u043e \u043e\u0442\u043f\u0440\u0430\u0432\u043b\u044f\u0435\u043c \u0441 \u0430\u043a\u0442\u0438\u0432\u0430\u0446\u0438\u0435\u0439 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430<\/li>\n<li>\u0435\u0441\u043b\u0438 2, \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c 1 \u0440\u0430\u0437\u0440\u044f\u0434<\/li>\n<\/ul>\n<p> \u0422\u043e \u0435\u0441\u0442\u044c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u0435\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043f\u0430\u0440\u0443 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0439 \u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u043e\u0440\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0441\u0443\u043c\u043c\u0430\u0440\u043d\u0430\u044f \u0446\u0435\u043f\u043e\u0447\u043a\u0430 \u0431\u0443\u0434\u0435\u0442 2*n. \u041d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0447\u0438\u0441\u043b\u043e \u0432 \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0440\u0435\u0432\u0440\u0430\u0442\u0438\u0442\u044c \u0432 \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u0435. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043d\u0430\u0434\u043e \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u0432 \u0434\u0440\u0443\u0433\u0443\u044e \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u0443\u044e \u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u0441\u043e \u0441\u0434\u0432\u0438\u0433\u043e\u043c, \u0432\u0435\u0434\u044c \u043e\u043d\u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0431\u044b\u043b\u0438 \u0431\u0438\u0442\u0430\u043c\u0438 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430. \u042d\u0442\u043e \u0434\u0435\u0439\u0441\u0442\u0432\u0438\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u0442 \u0435\u0449\u0451 \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0438, \u043d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u044b \u043f\u0440\u0438\u0445\u043e\u0434\u044f\u0442 \u0440\u0430\u043d\u044c\u0448\u0435, \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u044d\u0442\u043e \u0432\u0440\u0435\u043c\u044f \u0431\u0443\u0434\u0435\u0442 \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u043c \u043f\u0440\u0438 \u043d\u0430\u043b\u0438\u0447\u0438\u0438 \u0446\u0435\u043f\u043e\u0447\u0435\u043a \u0443\u0441\u043a\u043e\u0440\u0435\u043d\u0438\u044f \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0432 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u0435.<br \/> \u0412 \u043a\u043e\u043d\u0446\u0435 \u043d\u0430\u0434\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0442\u044c \u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u043d\u0430 \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 1\/x.<\/p>\n<h4>\u041f\u0435\u0440\u0441\u043f\u0435\u043a\u0442\u0438\u0432\u044b \u0440\u0430\u0437\u0432\u0438\u0442\u0438\u044f<\/h4>\n<p> \u0414\u0432\u0430 \u044d\u0442\u0430\u043f\u0430 \u043f\u043e\u0434\u0431\u043e\u0440\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u043a\u0440\u0430\u0442\u0438\u0442\u044c \u0434\u043e \u043e\u0434\u043d\u043e\u0433\u043e, \u043f\u0440\u0438\u0432\u0435\u0434\u044f \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u043a \u0444\u043e\u0440\u043c\u0435 0.10xxx. \u0415\u0441\u043b\u0438 \u0443\u0436 \u043c\u043e\u0436\u043d\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441\u0447\u0438\u0442\u0430\u044f \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0441\u0443\u043c\u043c\u0443 \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c \u0438\u0437 \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430 \u0438 \u0431\u0435\u0437, \u0442\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0438 \u0432 \u044d\u0442\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u0435. \u0412\u044b\u0445\u043e\u0434\u043d\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0438\u0441\u0442\u0435\u043c\u0435 \u0441\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043e \u043d\u0435\u043e\u0434\u043d\u043e\u0437\u043d\u0430\u0447\u043d\u043e, \u0447\u0442\u043e \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0442\u0440\u0430\u043c\u0431\u043e\u0432\u0430\u0442\u044c 3-\u043a\u0438 \u0432 \u043f\u043e\u0442\u043e\u043a \u0434\u043e \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u043e\u043d\u0438 \u043e\u043a\u0430\u0436\u0443\u0442\u0441\u044f \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435. \u042d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0435\u0440\u0435\u0441\u043a\u0430\u043a\u0438\u0432\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043f\u043e 2 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0438\u043b\u0438 \u0431\u043e\u043b\u044c\u0448\u0435. \u041d\u0430\u0442\u0440\u0430\u043c\u0431\u043e\u0432\u0430\u0442\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0432 \u0441\u0435\u0440\u0435\u0434\u0438\u043d\u0443 \u043f\u043e\u0442\u043e\u043a\u0430 \u0438\u043b\u0438 \u0432 \u043d\u0430\u0447\u0430\u043b\u043e, \u043f\u0440\u0430\u0432\u0434\u0430 \u0435\u0441\u0442\u044c \u043f\u0440\u043e\u0431\u043b\u0435\u043c\u0430 \u0441 \u0442\u0435\u043c, \u0447\u0442\u043e \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437 \u0442\u043e\u043b\u044c\u043a\u043e \u043f\u043e 1 \u0438 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u0438\u0442\u0441\u044f \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0434\u0438\u0430\u043f\u0430\u0437\u043e\u043d \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434\u0430. \u041c\u043e\u0436\u043d\u043e \u043f\u0440\u0435\u0434\u0432\u0430\u0440\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u0432\u0435\u0441\u0442\u0438 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u043a \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044e 0.1111xxx\u2026 \u0438 \u043d\u0430\u0434\u0435\u044f\u0442\u044c\u0441\u044f \u043d\u0430 \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0442\u0440\u043e\u0435\u043a \u0432 \u043f\u0440\u0435\u0434\u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0445 \u0431\u0438\u0442\u0430\u0445. \u041c\u043e\u0436\u043d\u043e \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f: \u0435\u0441\u043b\u0438 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0431\u0438\u0442, \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u0432 \u043f\u0440\u0435\u0434\u044b\u0434\u0443\u0449\u0438\u0439. \u041f\u0440\u0438 \u0431\u043e\u043b\u044c\u0448\u0435\u0439 \u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0441\u0442\u0438 \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0431\u0438\u0442 \u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430. \u0415\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043c\u0435\u0442\u0438\u0442\u044c, \u0447\u0442\u043e \u043a\u043e\u0434 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0439 \u0441\u0442\u0440\u043e\u043a\u0438 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0445\u043e\u0440\u043e\u0448\u043e \u043d\u0430\u0440\u0435\u0437\u0430\u0435\u0442\u0441\u044f \u0438 \u0437\u0430\u0446\u0438\u043a\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f, \u0435\u0441\u043b\u0438 \u0437\u0430\u0445\u043e\u0447\u0435\u0442\u0441\u044f \u0440\u0430\u0437\u0431\u0438\u0442\u044c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0430\u0434\u0438\u0439.<\/p>\n<h4>\u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435<\/h4>\n<p> \u0414\u043b\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0435\u0434\u043b\u043e\u0436\u0435\u043d\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043c\u043e\u0436\u0435\u0442 \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0442\u044c \u0435\u0449\u0451 \u043b\u0443\u0447\u0448\u0435. \u0415\u0441\u043b\u0438 \u043d\u0430 \u043a\u0430\u0436\u0434\u043e\u043c \u044d\u0442\u0430\u043f\u0435 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u043f\u043e \u043e\u0434\u043d\u043e\u043c\u0443 \u0447\u0438\u0441\u043b\u0443, \u0442\u043e \u0437\u0430 \u0441\u0447\u0451\u0442 \u0440\u0430\u0437\u0440\u044b\u0432\u0430 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0437\u0430 n \u043e\u0434\u043d\u043e\u0431\u0438\u0442\u043d\u044b\u0445 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u043e\u0432. \u041f\u043e\u043d\u044f\u0442\u043d\u043e, \u0447\u0442\u043e \u0442\u0430\u043c \u0435\u0449\u0451 \u043c\u043e\u0436\u043d\u043e \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0439, \u043d\u0430\u0440\u0435\u0437\u0430\u0432 \u0446\u0435\u043f\u043e\u0447\u043a\u0443 \u0438 \u0441\u043b\u043e\u0436\u0438\u0432 \u0431\u044b\u0441\u0442\u0440\u044b\u043c \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u043e\u043c.<\/p>\n<h4>\u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f<\/h4>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u0442\u0435\u0441\u0442 \u043d\u0430 Python. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">overflow_1.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\"># \u0448\u0430\u0433 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u0440\u044f\u0434 def add_bit(accum, carry, value): carry = carry &lt;&lt; 1 new_carry = (accum &amp; value) | (accum &amp; carry) | (value &amp; carry) new_accum = accum ^ value ^ carry return new_accum, new_carry  #\u044d\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u043b\u043e\u043c\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b #value = 0b1_0011_0010_0000 # \u043d\u0430 \u0447\u0442\u043e \u0434\u0435\u043b\u0438\u043c #value = 0b1_1000_0000_0000 #value = 0b1_1110_1111_1111 #value = 0b1_0111_1111_1111 #value = 0b1_0100_0000_0000 #value = 0b1_0101_1101_0101 #value = 0b1_0001_0001_0000 #value = 0b1_0000_0100_0000 #\u0434\u0430\u0451\u0442 111 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 #value = 0b1_0000_0000_0001 value = 0b1_0000_0000_0000 # \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 111... #value = 0b1_1111_1111_1111 rvalue = 0b1_0000_0000_0000_0000_0000_0000 \/\/ value # \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f print(bin(rvalue)[2:].rjust(16), \" reverse\")  divider = value count = len(bin(divider)) - 2 # \u0447\u0438\u0441\u043b\u043e \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u0431\u0438\u0442 res = 1 # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 sum = divider # \u0431\u0438\u0442\u044b \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 carry = 0 # \u0431\u0438\u0442\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430, \u043e\u043d\u0438 \u0436\u0435 \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 sig_bits = 2 # \u0431\u0438\u0442\u044b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432  print(\"value      \", bin(value)[2:].rjust(count+1)) print(\"start_value\", bin(sum)[2:].rjust(count+1)) for i in range(0, count - 1): # \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u0438\u0442\u043e\u0432 mask = (1 &lt;&lt; sig_bits) - 1 print(\"\\ni = \", i, \"mask = \", bin(mask)[2:]) # \u0432\u044b\u0434\u0435\u043b\u044f\u0435\u043c \u043c\u0435\u0441\u0442\u043e \u0434\u043b\u044f \u043d\u043e\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430 sum = (sum &lt;&lt; 1) &amp; ((1 &lt;&lt; count) - 1) carry = (carry &lt;&lt; 1) &amp; ((1 &lt;&lt; count) - 1) # \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0431\u0438\u0442\u044b \u0432 \u0434\u0432\u0443\u0445 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u0430\u0445 sum_part = ((sum &lt;&lt; (sig_bits)) &gt;&gt; (count+1)) carry_part = ((carry &lt;&lt; sig_bits) &gt;&gt; (count)) &amp; mask digit = sum_part + (carry_part &amp; 2) # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 print(\"sum, carry, digit \", bin(sum_part)[2:], bin(carry_part)[2:], bin(digit)[2:]) res = res &lt;&lt; 1 if digit != 3: # \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 digit = sum_part + carry_part # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 delta = 0 if digit == 0: delta = divider &lt;&lt; 1 res += 2 elif digit == 1: delta = divider res += 1 #print(\"add2 \", bin(sum)[2:].ljust(16), bin(carry)[2:].ljust(16), bin(delta)[2:].ljust(16)) print(\"add2 s     \", bin(sum)[2:].rjust(count+1)) print(\"add2 c     \", bin(carry)[2:].rjust(count+1)) print(\"add2 d     \", bin(delta)[2:].rjust(count+1)) sum, carry = add_bit(sum, carry, delta)  sum_part = ((sum &lt;&lt; sig_bits) &gt;&gt; (count + 1)) # \u0437\u0434\u0435\u0441\u044c \u043e\u0431\u0430 \u0431\u0438\u0442\u0430, \u0442\u0430\u043a \u043a\u0430\u043a \u043f\u0440\u0438 \u0441\u0434\u0432\u0438\u0433\u0435 \u0434\u043e\u0431\u0430\u0432\u043a\u0438 \u043e\u043d\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u043d\u0435 \u0432 \u043f\u0435\u0440\u0435\u043d\u043e\u0441 carry_part = ((carry &lt;&lt; sig_bits) &gt;&gt; (count)) &amp; mask digit = sum_part + (carry_part &amp; 2) print(\"sum, carry, digit \", bin(sum_part)[2:], bin(carry_part)[2:], bin(digit)[2:]) if digit != 3: # \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 digit = sum_part + carry_part delta = 0 if digit == 2: delta = divider res += 1 #print(\"add1 \", bin(sum)[2:].ljust(16), bin(carry)[2:].ljust(16), bin(delta)[2:].ljust(16)) print(\"add1 s     \", bin(sum)[2:].rjust(count+1)) print(\"add1 c     \", bin(carry)[2:].rjust(count+1)) print(\"add1 d     \", bin(delta)[2:].rjust(count+1)) sum, carry = add_bit(sum, carry, delta) print(\"           \", bin(sum)[2:].rjust(count+1)) print(\"           \", bin(carry)[2:].rjust(count+1)) print(\"           \", bin(res)[2:].rjust(count+1))   print(\"sum:        \", bin((sum + (carry &lt;&lt; 1))&gt;&gt;(count-3))[2:].ljust(16)) print(\"error:      \", bin(res - (rvalue &lt;&lt; 6))[2:].ljust(16))  print(\"\\n\") print(\"result:        \", bin(res)[2:].ljust(16), res) print(\"reverse:       \", bin(rvalue)[2:].ljust(16), rvalue) print(\"\\n\") print(\"value:         \", bin(value)[2:].ljust(16), value) print(\"value*res:     \", bin(value*res)[2:]) print(\"value*reverse: \", bin(value*rvalue)[2:])   <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> \u0412 \u043a\u043e\u043d\u0446\u0435 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f \u0447\u0438\u0441\u043b\u043e 0.1333&#8230;, \u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0440\u0430\u0441\u043f\u0430\u0434\u0430\u0435\u0442\u0441\u044f \u0432 0.1111\u2026 + 0.111\u2026 = 1.1101, \u043d\u0435\u043c\u043d\u043e\u0433\u043e \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442 \u0434\u043e 10.0, \u0442\u043e \u0435\u0441\u0442\u044c \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u0447\u0443\u0442\u044c \u043c\u0435\u043d\u044c\u0448\u0435 \u0447\u0435\u043c \u043d\u0430\u0434\u043e, \u0437\u043d\u0430\u0447\u0438\u0442 \u0438 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c \u0442\u043e\u0436\u0435. \u041f\u0440\u043e\u0441\u0442\u043e \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0442\u044c \u043d\u0435\u043b\u044c\u0437\u044f, \u0442\u0430\u043a \u043a\u0430\u043a \u0447\u0438\u0441\u043b\u0430 \u0432\u0440\u043e\u0434\u0435 10001000 \u043c\u043e\u0433\u0443\u0442 \u0434\u0430\u0432\u0430\u0442\u044c \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0440\u044f\u0434 1 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u043a\u043e\u043d\u0446\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c, \u043d\u0430\u0434\u043e \u043b\u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u0438\u0442\u044c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 1. \u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0434\u043b\u044f float \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u043e\u0434\u0445\u043e\u0434\u0438\u0442 \u043b\u0443\u0447\u0448\u0435.<br \/> \u0420\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 verilog \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a (\u043d\u0430 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0435 \u043d\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u043b). <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">float_div.v<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vhdl\">module RiscVFastDivider ( input [31:0] x, \/\/\u0434\u0435\u043b\u0438\u043c\u043e\u0435 \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 1* output [31:0] result \/\/\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u0432 \u0444\u043e\u0440\u043c\u0430\u0442\u0435 1*. \u041a\u043e\u0433\u0434\u0430 \u0434\u0435\u043b\u0438\u043c 1\/0.1, \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 111... );  \/\/ result = 1 \/ x \/\/ x = [0.100..., 0.111...] \/\/ 1\/x = [1.000..., 1.111...] \/\/10.000 - \u044d\u0442\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c (1 &lt;&lt; 31) (\u043b\u0435\u0432\u0430\u044f \u0433\u0440\u0430\u043d\u0438\u0446\u0430 \u0431\u043e\u043b\u044c\u0448\u0435 \u043f\u0440\u0430\u0432\u043e\u0439)  always @* begin integer i; wire [31:0] numerator = 1; wire [31:0] numerator_carry = 0; wire [31:0] divider = x; wire [31:0] divider_sum = divider; wire [31:0] divider_carry = 0;      \/\/\u044d\u0442\u043e \u0431\u0438\u0442\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f, \u0442.\u0435. \u0431\u0438\u0442 = 1, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u044f\u0434 = 2 \u0438\u043b\u0438 3  \/\/ \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0439 \u043d\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u044b \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e \u0441 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435\u043c \/\/ \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u043c \u043a \u0432\u0438\u0434\u0443 0.1333xxx == 0.1111xxx + 0.111xxx = 1.110xxx = 10.00 - 0.00xxx  for(i = 0; i &lt; 32; i = i + 1) begin \/\/ \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0432 \u0437\u043d\u0430\u043c\u0435\u043d\u0430\u0442\u0435\u043b\u0435 divider_sum = divider_sum &lt;&lt; 1; divider_carry = divider_carry &lt;&lt; 1;  wire [1:0] out_place; \/\/ \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0440\u0430\u0437\u0440\u044f\u0434 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430  \/\/ \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0432 1 wire [1:0] place = {divider_carry[31], divider_sum[31]}; \/\/\u0431\u0435\u0440\u0451\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f wire [31:0] divider_sum_2;  \/\/\u043f\u043e\u0441\u043b\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0448\u0430\u0433\u0430 \u0437\u0434\u0435\u0441\u044c \u0434\u043e\u043b\u0436\u043d\u043e \u0431\u044b\u0442\u044c \u043c\u0438\u043d\u0438\u043c\u0443\u043c 2 \u0432 31 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 wire [31:0] divider_carry_2; if (place == 3) begin divider_sum_2 = divider_sum; divider_carry_2 = divider_carry; out_place = 0; end else begin wire carry_bit = divider_carry[30]; wire [1:0] next_place = place + carry_bit; wire [31:0] addition; if (next_place == 3 or next_place == 2) begin addition = 0; out_place = 0; end else if (next_place == 1) begin addition = divider; out_place = 1; end else addition = divider &lt;&lt; 2; out_place = 2; end \/\/\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 1 \u0448\u0430\u0433 \/\/\u0441\u0430\u043c\u044b\u0439 \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0439 \u0431\u0438\u0442 \u0438\u0437 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u043f\u043e\u043f\u0430\u0434\u0430\u0435\u0442 \u0432 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0439 \u0431\u0438\u0442 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \/\/\u043d\u043e \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u043e\u043d \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0442\u043e\u0447\u043d\u043e =1, \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u0442\u044c \u0441\u0443\u043c\u043c\u0443 \u0434\u043e 33 \u0431\u0438\u0442 \u043d\u0435 \u0431\u0443\u0434\u0435\u043c \/\/\u043f\u043e \u0442\u043e\u0439 \u0436\u0435 \u043f\u0440\u0438\u0447\u0438\u043d\u0435 addition = divider &lt;&lt; 2 \u043d\u0435 \u0440\u0430\u0441\u0448\u0438\u0440\u044f\u043b\u0438 wire [31:0] carry_addition = divider_carry &lt;&lt; 1; divider_sum_2 = divider_sum ^ carry_addition ^ addition; divider_carry_2 = (divider_sum &amp; carry_addition) | (divider_sum &amp; addition) | (carry_addition &amp; addition);  end  \/\/ \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0432 1 wire place_2 = divider_sum_2[31]; \/\/\u0431\u0435\u0440\u0451\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f if (place_2 == 1) begin divider_sum = divider_sum_2; divider_carry = divider_carry_2; out_place = out_place + 0; end else begin wire carry_bit_2 = divider_carry_2[30]; wire [31:0] addition_2; if (carry_bit_2 == 1) begin addition_2 = 0; out_place = out_place + 0; end else begin addition_2 = divider; out_place = out_place + 1; end  \/\/ \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 wire [31:0] carry_addition_2 = divider_carry_2 &lt;&lt; 1; divider_sum = divider_sum_2 ^ carry_addition_2 ^ addition_2; divider_carry = (divider_sum_2 &amp; carry_addition_2) | (divider_sum_2 &amp; addition_2) | (carry_addition_2 &amp; addition_2); end  \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0432 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c numerator = (numerator &lt;&lt; 1); numerator_carry = (numerator_carry &lt;&lt; 1); numerator[0] = out_place[0]; numerator_carry[0] = out_place[1]; end  result = (numerator + (numerator_carry &lt;&lt; 1)) &gt;&gt; 1; end <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <\/p>\n<h4>\u0412\u0435\u0440\u0441\u0438\u044f \u0431\u0435\u0437 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0432 \u043a\u043e\u043d\u0446\u0435<\/h4>\n<p> \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0432\u0441\u0451 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442, \u043d\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0435 \u0432\u044b\u0434\u0430\u0451\u0442 \u043e\u0441\u0442\u0430\u0442\u043e\u043a, \u0430 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u0431\u044b. \u0420\u0430\u0437 \u0443\u0436 \u043f\u043e\u043b\u0443\u0447\u0438\u043b\u043e\u0441\u044c \u0441 \u0435\u0434\u0438\u043d\u0438\u0446\u0430\u043c\u0438, \u043f\u043e\u0447\u0435\u043c\u0443 \u0431\u044b \u043d\u0435 \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u0441 \u043d\u0443\u043b\u044f\u043c\u0438. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0432\u043e\u0437\u044c\u043c\u0451\u043c \u043e\u0431\u044b\u0447\u043d\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u0441\u043a\u043e\u0440\u0438\u043c \u0435\u0433\u043e \u0437\u0430 \u0441\u0447\u0451\u0442 \u0440\u0430\u0437\u043e\u0440\u0432\u0430\u043d\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u0432. \u041d\u0430 \u044d\u0442\u043e\u0442 \u0440\u0430\u0437 \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u043d\u0430\u0434\u043e \u043f\u043e\u043b\u0443\u0447\u0430\u0442\u044c 0, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043c\u043e\u0436\u043d\u043e \u043d\u0435 \u0432\u043e\u043b\u043d\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043d\u0430\u0441\u0447\u0451\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0443\u0431\u0440\u0430\u0442\u044c \u043f\u043e\u0434\u043e\u0431\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u043a\u0430\u043a \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435, \u043d\u043e \u043d\u0430\u0434\u043e \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u0442\u044c, \u043a\u0430\u043a\u043e\u0439 \u0431\u0438\u0442 \u0441\u0435\u0439\u0447\u0430\u0441 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0431\u0438\u0442\u043e\u043c \u0437\u043d\u0430\u043a\u0430. \u0418 \u0442\u0430\u043a, \u0431\u0435\u0440\u0451\u043c \u043d\u0435\u043a\u0438\u0439 \u043e\u0441\u0442\u0430\u0442\u043e\u043a 1xxx \u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u0438\u0437 \u043d\u0435\u0433\u043e \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c 1yyy. \u041f\u0440\u0438 \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0438 \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043f\u0440\u043e\u0442\u0430\u0441\u043a\u0438\u0432\u0430\u0442\u044c 1 \u0432 \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u0435, \u043e\u0441\u0442\u0430\u0432\u043b\u044f\u044f \u0435\u0451 \u043d\u0430 1 \u0431\u0438\u0442 \u043b\u0435\u0432\u0435\u0435 \u0440\u0430\u0441\u0441\u043c\u0430\u0442\u0440\u0438\u0432\u0430\u0435\u043c\u043e\u0433\u043e, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \u043d\u0435 \u0442\u0430\u043a<br \/> 1xxx \u2014 <br \/> 1yyy<br \/> \u0430 \u0442\u0430\u043a<br \/> 1xxx \u2014 <br \/> _1yyy<\/p>\n<p> \u042d\u0442\u043e \u043d\u0430\u0434\u043e \u0434\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u0433\u0430\u0440\u0430\u043d\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u043e \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u0441\u0442\u0430\u0442\u043a\u0430. \u0421 \u0434\u0440\u0443\u0433\u043e\u0439 \u0441\u0442\u043e\u0440\u043e\u043d\u044b, \u043f\u043e\u0434\u043e\u0431\u043d\u044b\u0439 \u0444\u043e\u043a\u0443\u0441 \u0441\u0442\u0430\u043d\u0435\u0442 \u043e\u0447\u0435\u0432\u0438\u0434\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u043d\u0430 \u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0447\u0438\u0441\u043b\u043e.<br \/> -0_1yyy = 1_yyyy<br \/> \u0421\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u043f\u0440\u0435\u0432\u0440\u0430\u0449\u0430\u0435\u0442\u0441\u044f \u0432 \u0440\u0430\u0437\u0440\u044f\u0434 \u0437\u043d\u0430\u043a\u0430. \u0418 \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u0442\u0430\u043a\u043e\u0435 \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044e, \u0437\u043d\u0430\u043a \u0443\u043a\u0430\u0442\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432\u043b\u0435\u0432\u043e<br \/> 0000_1xxx +<br \/> 1111_1yyy_y =<br \/> 0000_?zzz_z<br \/> ? \u043e\u0437\u043d\u0430\u0447\u0430\u0435\u0442, \u0447\u0442\u043e \u0441 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u043c\u043e\u0436\u0435\u0442 \u043d\u0435 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0436\u0435 \u0434\u0432\u0435 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043d\u0430 \u0440\u0430\u0437\u0440\u044f\u0434. \u0421\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0438\u0442\u043e\u0433\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c.<br \/> \u0411\u0435\u0440\u0451\u043c 0 \u0438\u043b\u0438 1 \u0438\u0437 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f (\u0435\u0451 \u043c\u044b \u043f\u0440\u043e\u0442\u044f\u0433\u0438\u0432\u0430\u0435\u043c \u043f\u043e \u0432\u0441\u0435\u0439 \u0446\u0435\u043f\u043e\u0447\u043a\u0435), \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u0438\u0437 \u0431\u043e\u043b\u0435\u0435 \u043c\u043b\u0430\u0434\u0448\u0435\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c 10 + 11 + 1 = 110, \u0442.\u0435. \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u043d\u0430\u0434\u043e \u0441\u043a\u043e\u043c\u043f\u0435\u043d\u0441\u0438\u0440\u043e\u0432\u0430\u0442\u044c 6 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435.<br \/> \u041d\u0430 \u043f\u0435\u0440\u0432\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u0441\u0442\u0430\u0440\u0430\u0435\u043c\u0441\u044f \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0431\u0438\u0442. <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u0441\u0443\u043c\u043c\u0430 1, \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c 0<\/li>\n<li>\u0435\u0441\u043b\u0438 2 \u0438\u043b\u0438 3, \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c 1<\/li>\n<li>\u0435\u0441\u043b\u0438 4+, \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c 2<\/li>\n<\/ul>\n<p> \u0422\u0443\u0442 \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u043f\u0440\u043e\u0431\u043e\u0432\u0430\u0442\u044c \u043d\u0435 \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0442\u044c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434.<br \/> \u041d\u0430 \u0432\u0442\u043e\u0440\u043e\u0439 \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u0438 \u043e\u0431\u043d\u0443\u043b\u044f\u0435\u043c \u0432\u0442\u043e\u0440\u043e\u0439 \u0431\u0438\u0442. <\/p>\n<ul>\n<li>\u0435\u0441\u043b\u0438 \u0441\u0443\u043c\u043c\u0430 0 \u0438\u043b\u0438 1, \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c 0<\/li>\n<li>\u0435\u0441\u043b\u0438 2 \u0438\u043b\u0438 3, \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c 1<\/li>\n<\/ul>\n<p> \u041e\u0431\u044b\u0447\u043d\u043e -1yyy = 11yy, \u043d\u043e \u0435\u0441\u0442\u044c \u043f\u0440\u0435\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 -1000 = 1000, \u043f\u043e\u0434\u0441\u0442\u0430\u043d\u043e\u0432\u043a\u043e\u0439 \u043e\u0431\u043e\u0438\u0445 \u0432\u0430\u0440\u0438\u0430\u043d\u0442\u043e\u0432 \u043c\u043e\u0436\u043d\u043e \u0443\u0431\u0435\u0434\u0438\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432 \u0438\u0442\u043e\u0433\u0435 \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u043e\u0441\u0442\u0430\u043d\u0435\u0442\u0441\u044f 0 \u0438\u043b\u0438 1, \u0442\u043e \u0435\u0441\u0442\u044c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043a\u0430\u043a \u043d\u0430\u0434\u043e.<\/p>\n<p> \u0414\u043b\u044f \u043d\u0430\u0447\u0430\u043b\u0430 \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043d\u0430 Python. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">overflow_0.py<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"python\">#\u043f\u0440\u044f\u043c\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c  def bin2(value): return \"{:_b}\".format(value)  # \u0448\u0430\u0433 \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u043e\u043c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043e\u0434\u0438\u043d \u0440\u0430\u0437\u0440\u044f\u0434 # \u043d\u043e \u0442\u0435\u043f\u0435\u0440\u044c 11 \u0438\u043d\u0442\u0435\u0440\u043f\u0440\u0435\u0442\u0438\u0440\u0443\u0435\u043c \u043a\u0430\u043a -1 def add_bit(accum, carry, value): carry = carry &lt;&lt; 1 new_carry = (accum &amp; value) | (accum &amp; carry) | (value &amp; carry) new_accum = accum ^ value ^ carry return new_accum, new_carry  #\u044d\u0442\u0438 \u0447\u0438\u0441\u043b\u0430 \u043b\u043e\u043c\u0430\u043b\u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u044b #value = 0b1_0011_0010_0000 # \u043d\u0430 \u0447\u0442\u043e \u0434\u0435\u043b\u0438\u043c #value = 0b1_1000_0000_0000 #value = 0b1_1110_1111_1111 #value = 0b1_0111_1111_1111 #value = 0b1_0100_0000_0000 #value = 0b1_0101_1101_0101 #value = 0b1_0001_0001_0000 #value = 0b1_0000_0100_0000 #\u0434\u0430\u0451\u0442 111 \u043f\u043e\u0441\u043b\u0435 \u0437\u0430\u043f\u044f\u0442\u043e\u0439 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 value = 0b1_0000_0000_0001 #value = 0b1_0000_0000_0000 # \u0437\u0434\u0435\u0441\u044c \u0442\u043e\u0447\u043d\u043e\u0441\u0442\u0438 \u043d\u0435 \u0445\u0432\u0430\u0442\u0430\u0435\u0442, \u043f\u043e\u043b\u0443\u0447\u0430\u0435\u0442\u0441\u044f 111... #value = 0b1_1111_1111_1111 divisible = 0b1_0000_0000_0000_0000_0000_0000 rvalue = divisible \/\/ value # \u0447\u0442\u043e \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f  divider = value count = len(bin(divider)) - 2 # \u0447\u0438\u0441\u043b\u043e \u0437\u043d\u0430\u0447\u0430\u0449\u0438\u0445 \u0431\u0438\u0442 div_count = len(bin(divisible)) - 2 res = 0 # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 remainder = 0 # \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f carry = 0 # \u0431\u0438\u0442\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430, \u043e\u043d\u0438 \u0436\u0435 \u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 sig_bits = 2 # \u0431\u0438\u0442\u044b, \u0443\u0447\u0438\u0442\u044b\u0432\u0430\u0435\u043c\u044b\u0435 \u0434\u043b\u044f \u0440\u0430\u0441\u0447\u0451\u0442\u043e\u0432 mask = (1 &lt;&lt; count) - 1 wide_mask = (1 &lt;&lt; (count + 1)) - 1  print(\"reverse    \", bin2(rvalue).rjust(count+5)) print(\"value      \", bin2(value &amp; wide_mask).rjust(count+5)) print(\"wide_mask  \", bin2(wide_mask).rjust(count+5)) print(\"-value     \", bin2((-value) &amp; wide_mask).rjust(count+5)) print(\"-value*2   \", bin2(((-value) &amp; wide_mask)&lt;&lt;1).rjust(count+5)) for i in range(0, div_count): # \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u0435 \u0431\u0438\u0442\u043e\u0432 print(\"\\ni = \", i) # \u0432\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 remainder = ((remainder &lt;&lt; 1) + ((divisible &gt;&gt; (div_count - i - 1)) &amp; 1)) &amp; wide_mask # \u0437\u0434\u0435\u0441\u044c \u0445\u0440\u0430\u043d\u0438\u043c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0431\u0438\u0442 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 carry = (carry &lt;&lt; 1) &amp; mask  # \u0441\u043c\u043e\u0442\u0440\u0438\u043c \u043d\u0430 \u0431\u0438\u0442\u044b \u0432 \u0434\u0432\u0443\u0445 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u0430\u0445 sum_part = remainder &gt;&gt; (count - sig_bits + 1) carry_part = carry &gt;&gt; (count - sig_bits) digit = sum_part + (carry_part &amp; 2) # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 print(\"remainder_d, carry, digit \", bin2(sum_part), bin2(carry_part), bin2(digit)) res = res &lt;&lt; 1 if digit != 0 or digit == 0: # \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 digit = sum_part + carry_part # \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 \u0432 \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 delta = 0 if digit == 2 or digit == 3: delta = (-divider) &amp; wide_mask res += 1 if digit &amp; 4: delta = ((-divider) &lt;&lt; 1) &amp; wide_mask res += 2 print(\"add2 r     \", bin2(remainder).rjust(count+4)) print(\"add2 c     \", bin2(carry).rjust(count+4)) print(\"add2 d     \", bin2(delta).rjust(count+4)) remainder, carry = add_bit(remainder, carry, delta) carry = carry &amp; mask  sum_part = remainder &gt;&gt; (count - sig_bits + 1) carry_part = carry &gt;&gt; (count - sig_bits) digit = sum_part + (carry_part &amp; 2) print(\"remainder_d, carry, digit \", bin2(sum_part), bin2(carry_part), bin2(digit)) if digit != 0 or digit == 0: # \u043d\u0430\u0434\u043e \u0434\u0435\u043b\u0430\u0442\u044c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 digit = sum_part + carry_part delta = 0 if digit &amp; 2: delta = (-divider) &amp; wide_mask res += 1 print(\"add1 r     \", bin2(remainder).rjust(count+4)) print(\"add1 c     \", bin2(carry).rjust(count+4)) print(\"add1 d     \", bin2(delta).rjust(count+4)) remainder, carry = add_bit(remainder, carry, delta) remainder = remainder &amp; (wide_mask &gt;&gt; 1) # \u043e\u0442\u0431\u0440\u0430\u0441\u044b\u0432\u0430\u0435\u043c \u043e\u0431\u0440\u0430\u0431\u043e\u0442\u0430\u043d\u043d\u044b\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 carry = carry &amp; (mask &gt;&gt; 1) print(\"          \", bin2(remainder).rjust(count+5)) print(\"          \", bin2(carry).rjust(count+5)) print(\"          \", bin2(remainder + (carry &lt;&lt; 1)).rjust(count+5)) print(\"          \", bin2(res).rjust(count+5))  # \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \u043c\u043e\u0436\u0435\u0442 \u0434\u0430\u0442\u044c \u043c\u0430\u043a\u0441\u0438\u043c\u0443\u043c \u0435\u0449\u0451 +1 \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 # \u0437\u0434\u0435\u0441\u044c \u0441\u0440\u0430\u0432\u043d\u0438\u0432\u0430\u0435\u043c \u0434\u0432\u0430 \u0440\u0430\u0437\u0440\u044f\u0434\u0430, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c 1 sum_part = remainder &gt;&gt; (count - sig_bits) carry_part = carry &gt;&gt; (count - sig_bits - 1) digit = sum_part + carry_part digit_div = divider &gt;&gt; (count - sig_bits) print(\"\\n\") print(\"end digit \", digit, digit_div) if digit &gt; digit_div: delta = (-divider) &amp; wide_mask res += 1 remainder, carry = add_bit(remainder, carry, delta) print(\"-1 by digit\") print(\"          \", bin2(remainder).rjust(count+5)) print(\"          \", bin2(carry).rjust(count+5)) print(\"          \", bin2(remainder + (carry &lt;&lt; 1)).rjust(count+5)) print(\"          \", bin2(res).rjust(count+5)) print(\"\\n\")  # \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u0435\u0442 \u043e\u0442\u0441\u0442\u0430\u0432\u0430\u0442\u044c \u043d\u0430 1 \u0431\u0438\u0442 result_remainder = (remainder + (carry &lt;&lt; 1)) &amp; wide_mask if result_remainder &gt;= divider: result_remainder -= divider res += 1 print(\"-1 end round\")  real_remainder = divisible % value print(\"rem:        \", bin2(result_remainder).ljust(16), result_remainder) print(\"rem_real:   \", bin2(real_remainder).ljust(16), real_remainder) print(\"\\n\") print(\"result:        \", bin2(res).ljust(16), res) print(\"reverse:       \", bin2(rvalue).ljust(16), rvalue) print(\"\\n\") print(\"value:         \", bin2(value).ljust(16), value) print(\"value*result:  \", bin2(value*res)) print(\"value*reverse: \", bin2(value*rvalue)) <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u043d\u0430 verilog. \u0421\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430\u043c\u0438 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 1 \u0431\u0438\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0438\u0442 \u0442\u0430\u043a. <\/p>\n<pre><code class=\"vhdl\">reg [32:0] remainder_bit; reg [31:0] remainder_carry;  reg [32:0] remainder_bit_2; reg [31:0] remainder_carry_2;  reg [32:0] addition;  carry_addition = remainder_carry &lt;&lt; 1; remainder_bit_2 = remainder_bit ^ carry_addition ^ addition; remainder_carry_2 = (remainder_bit &amp; carry_addition) | (remainder_bit &amp; addition) | (carry_addition &amp; addition); <\/code><\/pre>\n<blockquote><p>\u0412\u043e\u0437\u043c\u043e\u0436\u043d\u043e, \u0442\u0430\u043a\u0430\u044f \u0440\u0443\u0447\u043d\u0430\u044f \u0437\u0430\u043f\u0438\u0441\u044c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u0440\u0438\u0432\u043e\u0434\u0438\u0442 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u041f\u041b\u0418\u0421 \u043d\u0435 \u043c\u043e\u0436\u0435\u0442 \u0435\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u0438\u0442\u044c.<\/p><\/blockquote>\n<p> \u041e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430 \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0440\u0430\u0437\u0440\u044f\u0434\u0430. <\/p>\n<pre><code class=\"vhdl\">next_place = remainder_bit[32:31] + remainder_carry[31:30]; reg [1:0] out_place; \/\/ \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0440\u0430\u0437\u0440\u044f\u0434 \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e reg [32:0] addition; if (next_place[2]) begin addition = (-divider) &lt;&lt; 1; \/\/1[xx] out_place = 2; end else if (next_place[1]) begin addition = -divider; \/\/1[1x] out_place = 1; end else begin addition = 0; out_place = 0; end <\/code><\/pre>\n<p> \u041f\u043e\u0441\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u044b \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u0432 \u043c\u043b\u0430\u0434\u0448\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 \u043c\u043e\u0436\u0435\u0442 \u043e\u0441\u0442\u0430\u0442\u044c\u0441\u044f \u0431\u0438\u0442 \u043f\u0435\u0440\u0435\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 1 \u0440\u0430\u0437 \u0432\u044b\u0447\u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c.  <\/p>\n<pre><code class=\"vhdl\">correction = 0; end_digit = remainder_bit[32:30] + remainder_carry[31:29]; if (end_digit &gt; divider[31:30]) begin correction = 1; ... end <\/code><\/pre>\n<p> \u0415\u0449\u0451 \u043f\u043e\u0441\u043b\u0435 \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u043d\u0438\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043a \u043d\u043e\u0440\u043c\u0430\u043b\u044c\u043d\u043e\u043c\u0443 \u0432\u0438\u0434\u0443 \u043c\u043e\u0436\u0435\u0442 \u043e\u043a\u0430\u0437\u0430\u0442\u044c\u0441\u044f, \u0447\u0442\u043e \u0432 \u043d\u0451\u043c \u043e\u0441\u0442\u0430\u043b\u0441\u044f \u043e\u0434\u0438\u043d \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c. <\/p>\n<pre><code class=\"vhdl\">remainder_sum = remainder_bit + (remainder_carry &lt;&lt; 1); remainder_diff = remainder_sum - divider; if ($signed(remainder_diff) &gt;= 0) begin correction = correction + 1; remainder_sum = remainder_diff; end <\/code><\/pre>\n<p> \u041f\u0435\u0440\u0435\u0434 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043d\u0430\u0434\u043e \u0432\u044b\u0440\u0430\u0432\u043d\u044f\u0442\u044c \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u043f\u043e \u043b\u0435\u0432\u043e\u043c\u0443 \u043a\u0440\u0430\u044e. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u043f\u043e\u043b\u043e\u0432\u0438\u043d\u0443, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0435\u0441\u0442\u044c \u043d\u0435\u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0438 \u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0441\u0434\u0432\u0438\u0433. <\/p>\n<pre><code class=\"vhdl\">function [4:0] clz(input [31:0] value); reg [4:0] result; reg [15:0] v16; reg [7:0] v8; reg [3:0] v4; reg [1:0] v2; begin result[4] = value[31:16] == 0? 1 : 0; v16 = result[4]? value[15:0] : value[31:16];  result[3] = v16[15:8] == 0? 1 : 0; v8 = result[3]? v16[7:0] : v16[15:8];  result[2] = v8[7:4] == 0? 1 : 0; v4 = result[2]? v8[3:0] : v8[7:4];  result[1] = v4[3:2] == 0? 1 : 0; v2 = result[1]? v4[1:0] : v4[3:2];  result[0] = v2[1] == 0? 1 : 0; clz = result; end endfunction <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0432\u0441\u0451 \u0432 \u043c\u043e\u0434\u0443\u043b\u044c. <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">fast_div.v<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vhdl\">module RiscVFastDiv ( input [31:0] x, \/\/\u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u0438 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435 \u043d\u0435\u043e\u0442\u0440\u0438\u0446\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0435 \u0447\u0438\u0441\u043b\u0430 input [31:0] y, output [31:0] quotient,  \/\/ \u0447\u0430\u0441\u0442\u043d\u043e\u0435 output [31:0] remainder  \/\/ \u043e\u0441\u0442\u0430\u0442\u043e\u043a );  wire [31:0] divisible;    \/\/ \u0434\u0435\u043b\u0438\u043c\u043e\u0435, \u0441\u043c\u0435\u0449\u0451\u043d\u043d\u043e\u0435 \u043d\u0430 \u0441\u0442\u043e\u043b\u044c\u043a\u043e \u0436\u0435 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 \u0447\u0442\u043e \u0438 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c wire [31:0] divisible2;   \/\/ \u0442\u0430 \u0447\u0430\u0441\u0442\u044c \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u044b\u043b\u0435\u0437\u043b\u0430 \u0437\u0430 \u0433\u0440\u0430\u043d\u0438\u0446\u044b \u043f\u0440\u0438 \u0441\u043c\u0435\u0449\u0435\u043d\u0438\u0438 wire [31:0] divider;      \/\/ \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c \u0441 1 \u0432 \u0441\u0442\u0430\u0440\u0448\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434\u0435 reg [31:0] quotient_out; \/\/ \u0447\u0430\u0441\u0442\u043d\u043e\u0435 reg [31:0] remainder_out;\/\/ \u043e\u0441\u0442\u0430\u0442\u043e\u043a  \/\/ [   divisible2] [divisible] \/\/ [divider      ] [000000000]  \/\/ \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u0442\u043e\u043c \u0444\u0430\u043a\u0442\u0435, \u0447\u0442\u043e 100 - 10 = 10, \u0432 \u0441\u0432\u043e\u044e \u043e\u0447\u0435\u0440\u0435\u0434\u044c 10 - 1 = 1, \u043d\u0443 \u0430 1 \u043a\u0430\u043a-\u043d\u0438\u0431\u0443\u0434\u044c \u043c\u043e\u0436\u043d\u043e \u043e\u0431\u043d\u0443\u043b\u0438\u0442\u044c reg [31:0] quotient_bit; reg [31:0] quotient_carry; reg [32:0] remainder_bit; reg [31:0] remainder_carry; reg [31:0] divisible_bit; reg [1:0] out_place;  reg [2:0] next_place; reg [32:0] addition; reg [32:0] carry_addition; reg [32:0] remainder_bit_2; reg [31:0] remainder_carry_2;  reg [1:0] next_place_2; reg [32:0] addition_2; reg [32:0] carry_addition_2;  reg [1:0] correction;  reg [2:0] end_digit; reg [32:0] addition_3; reg [32:0] carry_addition_3; reg [32:0] remainder_bit_3;  reg [32:0] remainder_sum; reg [32:0] remainder_diff;  always @(*) begin quotient_bit = 0; \/\/ \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u043c \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u043f\u0443\u0441\u0442\u043e quotient_carry = 0; remainder_bit = divisible2; \/\/\u044d\u0442\u0438 \u0431\u0438\u0442\u044b \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u0430\u0432\u0442\u043e\u043c\u0430\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0437\u0430\u0434\u0432\u0438\u043d\u0443\u0442\u044b \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0438 \u0442\u043e\u0447\u043d\u043e \u043c\u0435\u043d\u044c\u0448\u0435 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f remainder_carry = 0;      \/\/\u044d\u0442\u043e \u0431\u0438\u0442\u044b \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u043e\u0441\u0442\u0430\u0442\u043a\u0430, \u0442.\u0435. \u0431\u0438\u0442 = 1, \u043a\u043e\u0433\u0434\u0430 \u0440\u0430\u0437\u0440\u044f\u0434 = 2 \u0438\u043b\u0438 3 divisible_bit = divisible;  repeat(32) begin \/\/ \u0432\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0431\u0438\u0442 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e \u0432 \u043e\u0441\u0442\u0430\u0442\u043e\u043a remainder_bit = remainder_bit &lt;&lt; 1; remainder_carry = remainder_carry &lt;&lt; 1; remainder_bit[0] = divisible_bit[31]; divisible_bit = divisible_bit &lt;&lt; 1;  \/\/reg [1:0] out_place; \/\/ \u0447\u0442\u043e \u0437\u0430\u043f\u0438\u0448\u0435\u043c \u0432 \u0440\u0430\u0437\u0440\u044f\u0434 \u0447\u0430\u0441\u0442\u043d\u043e\u0433\u043e  \/\/ \u0438\u0442\u0435\u0440\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u0435\u043d\u0438\u044f \u0441\u0442\u0430\u0440\u0448\u0435\u0433\u043e \u0431\u0438\u0442\u0430 (2) \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0432 0 \/\/\u0431\u0435\u0440\u0451\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044f \u0441 \u0443\u0447\u0451\u0442\u043e\u043c \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u0441 \u043f\u0440\u043e\u0448\u043b\u043e\u0433\u043e \u0440\u0430\u0437\u0430 \u0432 remainder_bit[32] next_place = remainder_bit[32:31] + remainder_carry[31:30]; \/\/reg [32:0] addition; if (next_place[2]) begin addition = (-divider) &lt;&lt; 1; \/\/1[xx] out_place = 2; end else if (next_place[1]) begin addition = -divider; \/\/1[1x] out_place = 1; end else begin addition = 0; out_place = 0; end \/\/\u0434\u0435\u043b\u0430\u0435\u043c \u0441\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0441 \u0440\u0430\u0441\u043f\u0440\u043e\u0441\u0442\u0440\u0430\u043d\u0435\u043d\u0438\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 1 \u0448\u0430\u0433 carry_addition = remainder_carry &lt;&lt; 1; remainder_bit_2 = remainder_bit ^ carry_addition ^ addition; remainder_carry_2 = (remainder_bit &amp; carry_addition) | (remainder_bit &amp; addition) | (carry_addition &amp; addition);  \/\/ \u0442\u0435\u043f\u0435\u0440\u044c \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u043c \u043c\u043b\u0430\u0434\u0448\u0438\u0439 \u0431\u0438\u0442 (1) \u0440\u0430\u0437\u0440\u044f\u0434\u0430 \u0432 0 next_place_2 = remainder_bit_2[32:31] + remainder_carry_2[31:30]; \/\/reg [32:0] addition_2; if (next_place_2[1]) begin addition_2 = -divider;  \/\/ [1x] out_place = out_place + 1; end else begin addition_2 = 0; out_place = out_place + 0; end  \/\/ \u0435\u0449\u0451 \u0440\u0430\u0437 \u043f\u0440\u043e\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u043f\u0435\u0440\u0435\u043d\u043e\u0441 \/\/ \u0432 \u0441\u0442\u0430\u0440\u0448\u0435\u043c \u0431\u0438\u0442\u0435(32) \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c\u0441\u044f 0 carry_addition_2 = remainder_carry_2 &lt;&lt; 1; remainder_bit = remainder_bit_2 ^ carry_addition_2 ^ addition_2; remainder_carry = (remainder_bit_2 &amp; carry_addition_2) | (remainder_bit_2 &amp; addition_2) | (carry_addition_2 &amp; addition_2);  \/\/ \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0432 \u0447\u0430\u0441\u0442\u043d\u043e\u0435 quotient_bit = (quotient_bit &lt;&lt; 1); quotient_carry = (quotient_carry &lt;&lt; 1); quotient_bit[0] = out_place[0]; quotient_carry[0] = out_place[1]; end  correction = 0; \/\/\u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0449\u0451 \u043e\u0434\u043d\u043e \u043f\u0440\u043e\u0434\u0432\u0438\u0436\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u0430 \/\/\u0442\u0430\u043a \u043a\u0430\u043a \u0432 \u0445\u0443\u0434\u0448\u0435\u043c \u0441\u043b\u0443\u0447\u0430\u0435 \u043f\u0435\u0440\u0435\u043d\u043e\u0441\u044b \u043c\u043e\u0433\u0443\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c 1 \u0431\u0438\u0442 \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \/\/\u0438 \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0441\u043c\u043e\u0442\u0440\u0438\u043c 2 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u0430 end_digit = remainder_bit[32:30] + remainder_carry[31:29]; if (end_digit &gt; divider[31:30]) begin correction = 1; addition_3 = -divider; carry_addition_3 = remainder_carry &lt;&lt; 1; remainder_bit_3 = remainder_bit; remainder_bit = remainder_bit_3 ^ carry_addition_3 ^ addition_3; remainder_carry = (remainder_bit_3 &amp; carry_addition_3) | (remainder_bit_3 &amp; addition_3) | (carry_addition_3 &amp; addition_3); end  \/\/ \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u0435\u043c \u0438 \u043f\u0440\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0441\u0442\u0438 \u043e\u043a\u0440\u0443\u0433\u043b\u044f\u0435\u043c \u043d\u0430 1 remainder_sum = remainder_bit + (remainder_carry &lt;&lt; 1); remainder_diff = remainder_sum - divider; if ($signed(remainder_diff) &gt;= 0) begin correction = correction + 1; remainder_sum = remainder_diff; end  \/\/ \u0432\u044b\u0434\u0430\u0451\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 remainder_out = remainder_sum; quotient_out = quotient_bit + (quotient_carry &lt;&lt; 1) + correction; end  function [4:0] clz(input [31:0] value); reg [4:0] result; reg [15:0] v16; reg [7:0] v8; reg [3:0] v4; reg [1:0] v2; begin result[4] = value[31:16] == 0? 1 : 0; v16 = result[4]? value[15:0] : value[31:16];  result[3] = v16[15:8] == 0? 1 : 0; v8 = result[3]? v16[7:0] : v16[15:8];  result[2] = v8[7:4] == 0? 1 : 0; v4 = result[2]? v8[3:0] : v8[7:4];  result[1] = v4[3:2] == 0? 1 : 0; v2 = result[1]? v4[1:0] : v4[3:2];  result[0] = v2[1] == 0? 1 : 0; clz = result; end endfunction  \/\/\u0442\u0435\u043f\u0435\u0440\u044c \u043f\u0440\u0438\u0441\u043e\u0435\u0434\u0438\u043d\u044f\u0435\u043c \u0432\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0445\u043e\u0434\u044b \u043a \u0431\u043b\u043e\u043a\u0443 \u0434\u0435\u043b\u0435\u043d\u0438\u044f wire [4:0] offset = clz(y); assign divider = y &lt;&lt; offset; assign {divisible2, divisible} = x &lt;&lt; offset; assign remainder = remainder_out &gt;&gt; offset; assign quotient = quotient_out;  endmodule <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <\/p>\n<h4>\u0412\u043d\u0435\u0434\u0440\u0435\u043d\u0438\u0435<\/h4>\n<p> \u0412\u0435\u0440\u043d\u0451\u043c\u0441\u044f \u043a \u0438\u0441\u0445\u043e\u0434\u043d\u043e\u0439 \u0446\u0435\u043b\u0438 \u0441\u0442\u0430\u0442\u044c\u0438 \u2014 \u0441\u0431\u043e\u0440\u043a\u0435 RISC-V \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430. \u0423\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0441\u044f \u043a \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e\u043c\u0443 \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e M. \u0427\u0442\u043e\u0431\u044b \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u043d\u0430\u0447\u0430\u043b \u0435\u0433\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c, \u0437\u0430\u0434\u0430\u0434\u0438\u043c \u043f\u0440\u0430\u0432\u0438\u043b\u044c\u043d\u0443\u044e \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0443 \u0432 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u0445 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u0438. <\/p>\n<pre><code class=\"bash\">set arch=rv32em <\/code><\/pre>\n<p> \u0411\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u0447\u043d\u044b\u0435 \u0444\u0443\u043d\u043a\u0446\u0438\u0438 __umulsi3 \u0438 \u043f\u0440\u043e\u0447\u0438\u0435 \u043c\u043e\u0436\u043d\u043e \u0443\u0434\u0430\u043b\u0438\u0442\u044c (\u043d\u0443 \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0432\u0438\u0442\u044c \u043d\u0430 \u0441\u043b\u0443\u0447\u0430\u0439 \u0442\u0435\u0441\u0442\u043e\u0432 \u0431\u0435\u0437 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f).<br \/> \u041c\u043e\u0434\u0443\u043b\u044c \u0431\u0443\u0434\u0435\u0442 \u0432 \u0434\u0432\u0443\u0445 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f\u0445, \u0434\u043b\u044f \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439 \u0441\u0431\u043e\u0440\u043a\u0438 \u043d\u0430 \u041f\u041b\u0418\u0421 \u0438 \u043d\u0435\u043a\u0438\u0439 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0434\u043b\u044f ASIC. \u041c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u044b\u0439 \u0432\u0430\u0440\u0438\u0430\u043d\u0442 \u0431\u0443\u0434\u0435\u0442 \u043e\u0431\u044b\u0447\u043d\u044b\u043c \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u044b\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0430\u0435\u043c \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u043e\u0439 \u0448\u0430\u0436\u043e\u043a \u043a \u043a\u043e\u043d\u0432\u0435\u0439\u0435\u0440\u0443 \u0438 \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u0444\u043b\u0430\u0433 \u043e\u0436\u0438\u0434\u0430\u043d\u0438\u044f \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438. <\/p>\n<pre><code class=\"vhdl\">wire is_wait; \/\/\u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0442\u0430\u043a\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u0430 <\/code><\/pre>\n<p> \u0418\u0437\u043c\u0435\u043d\u0435\u043d\u0438\u0435 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0443\u043a\u0430\u0437\u0430\u0442\u0435\u043b\u044f \u043d\u0430 \u043a\u043e\u0434 <b>pc<\/b> \u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0430 <b>rd<\/b> \u0442\u0435\u043f\u0435\u0440\u044c \u0434\u0435\u043b\u0430\u0435\u0442\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u0432 \u043c\u043e\u043c\u0435\u043d\u0442, \u043a\u043e\u0433\u0434\u0430 \u043a\u043e\u043c\u0430\u043d\u0434\u0430 \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u043b\u0430. <\/p>\n<pre><code class=\"vhdl\">if (!is_wait) begin     regs[op_rd] &lt;= rd_result;     pc &lt;= pc_result; end <\/code><\/pre>\n<p> \u041d\u0430 \u044d\u0442\u043e\u043c \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0438 \u043c\u043d\u043e\u0433\u043e\u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 \u0437\u0430\u043a\u043e\u043d\u0447\u0435\u043d\u043e, \u0434\u0430\u043b\u044c\u0448\u0435 \u043e\u043f\u044f\u0442\u044c \u0438\u0434\u0451\u043c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 <a href=\"https:\/\/www.cs.sfu.ca\/~ashriram\/Courses\/CS295\/assets\/notebooks\/RISCV\/RISCV_CARD.pdf\" rel=\"nofollow noopener noreferrer\">\u043c\u0430\u043d\u0443\u0430\u043b\u044b<\/a>. \u041a\u043e\u043c\u0430\u043d\u0434\u044b \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438\u0434\u0443\u0442 \u043f\u043e\u0434 \u0442\u0435\u043c \u0436\u0435 \u043a\u043e\u0434\u043e\u043c, \u0447\u0442\u043e \u0438 \u0434\u0440\u0443\u0433\u0438\u0435 \u043a\u043e\u043c\u0430\u043d\u0434\u044b alu.<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yn\/tf\/sg\/yntfsgey6hfgkpgayc_ikjdh8qu.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yn\/tf\/sg\/yntfsgey6hfgkpgayc_ikjdh8qu.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yn\/tf\/sg\/yntfsgey6hfgkpgayc_ikjdh8qu.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/bx\/qc\/jy\/bxqcjyake8uoqah2v_5uxwfy5zu.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/bx\/qc\/jy\/bxqcjyake8uoqah2v_5uxwfy5zu.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/bx\/qc\/jy\/bxqcjyake8uoqah2v_5uxwfy5zu.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0420\u0430\u0437 \u043e\u043f\u043a\u043e\u0434 \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u044b\u0439, \u0435\u0441\u0442\u044c \u0441\u043c\u044b\u0441\u043b \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0439 \u043c\u043e\u0434\u0443\u043b\u044c alu.v. \u0412 \u043a\u043e\u0434\u0435 \u044f\u0434\u0440\u0430 \u044d\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u0433\u043b\u044f\u0434\u0435\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u0442\u0430\u043a. <\/p>\n<pre><code class=\"vhdl\">wire [31:0] rd_alu; wire is_alu_wait; RiscVAlu alu(                 .clock(clock),                 .reset(reset),                 .is_op_alu(is_op_alu),                 .is_op_alu_imm(is_op_alu_imm),                 .op_funct3(op_funct3),                 .op_funct7(op_funct7),                 .reg_s1(reg_s1),                 .reg_s2(reg_s2),                 .imm(op_immediate_i),                 .rd_alu(rd_alu),                 .is_alu_wait(is_alu_wait)             ); <\/code><\/pre>\n<p> \u041f\u043e\u043a\u0430 \u043c\u043e\u0434\u0443\u043b\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0434\u0438\u043d\u0441\u0442\u0432\u0435\u043d\u043d\u044b\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0442\u0430\u043a\u0442\u043e\u0432, \u0442\u0430\u043a \u0447\u0442\u043e \u0444\u043b\u0430\u0433 \u0437\u0430\u0434\u0435\u0440\u0436\u043a\u0438 \u0431\u0435\u0440\u0451\u043c \u043f\u0440\u044f\u043c\u043e \u0438\u0437 \u043d\u0435\u0433\u043e. <\/p>\n<pre><code class=\"vhdl\">assign is_wait = is_alu_wait; <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c, \u0447\u0442\u043e \u0443 \u043d\u0430\u0441 \u0431\u0443\u0434\u0435\u0442 \u0432 \u043d\u043e\u0432\u043e\u043c \u043c\u043e\u0434\u0443\u043b\u0435. \u0412\u043e-\u043f\u0435\u0440\u0432\u044b\u0445, \u043d\u0430\u0434\u043e \u043d\u0435 \u043b\u043e\u043c\u0430\u0442\u044c \u0441\u0442\u0430\u0440\u044b\u0439 \u0444\u0443\u043d\u043a\u0446\u0438\u043e\u043d\u0430\u043b. <\/p>\n<pre><code class=\"vhdl\">\/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 (add, sub, xor, or, and, sll, srl, sra, slt, sltu) \/\/\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0451\u0433\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0440\u0430\u0437\u0443 wire [31:0] alu_operand2 = is_op_alu ? reg_s2 : is_op_alu_imm ? imm : 0; wire [31:0] rd_alu1 = op_funct3_a == 3'd0 ? (is_op_alu &amp;&amp; op_funct7[5] ? reg_s1 - alu_operand2 : reg_s1 + alu_operand2) :   op_funct3_a == 3'd4 ? reg_s1 ^ alu_operand2 :   op_funct3_a == 3'd6 ? reg_s1 | alu_operand2 :   op_funct3_a == 3'd7 ? reg_s1 &amp; alu_operand2 :   op_funct3_a == 3'd1 ? reg_s1 &lt;&lt; alu_operand2[4:0] :   op_funct3_a == 3'd5 ? (op_funct7[5] ? $signed(reg_s1) &gt;&gt;&gt; alu_operand2[4:0] : reg_s1 &gt;&gt; alu_operand2[4:0]) :   op_funct3_a == 3'd2 ? $signed(reg_s1) &lt; $signed(alu_operand2) :   op_funct3_a == 3'd3 ? reg_s1 &lt; alu_operand2 : \/\/TODO \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 imm \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c   0; \/\/\u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 <\/code><\/pre>\n<p> \u0412\u043e-\u0432\u0442\u043e\u0440\u044b\u0445, \u0443\u0440\u0430, \u0434\u043e\u0431\u0440\u0430\u043b\u0438\u0441\u044c \u0434\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f. \u0412\u044b\u0431\u0438\u0440\u0430\u0442\u044c, \u0431\u044b\u043b\u043e \u043b\u0438 \u044d\u0442\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u0430\u044f \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f, \u043d\u0430\u0434\u043e \u043f\u043e \u0444\u043b\u0430\u0433\u0443 <b>op_funct7<\/b>. <\/p>\n<pre><code class=\"vhdl\">wire is_op_muldiv = is_op_alu &amp;&amp; op_funct7[0]; wire [2:0] op_funct3 = is_op_muldiv ? op_funct3_in : 3'b0; \/\/\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f M wire is_op_multiply = !op_funct3[2]; wire is_op_mul_signed = !op_funct3[1]; \/\/mul, mulh \/\/wire is_op_mul_low = op_funct3[1:0] == 0; \/\/mul wire is_op_mul_extend_sign = op_funct3[1:0] == 2; \/\/mulhsu \/\/\u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043a\u0430\u043a \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435, \u043d\u043e \u0441\u0430\u043c \u0437\u043d\u0430\u043a \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043e 64 \u0431\u0438\u0442 wire is_op_div_signed = !op_funct3[0]; \/\/div, rem \/\/wire is_op_remainder = op_funct3[2]; \/\/rem, remu <\/code><\/pre>\n<p> \u0414\u043b\u044f \u043c\u0435\u043d\u044c\u0448\u0438\u0445 32 \u0431\u0438\u0442 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0442\u043e\u0440 \u0432\u0441\u0435\u0433\u0434\u0430 \u0441\u043e\u0437\u0434\u0430\u0451\u0442 \u043a\u043e\u043c\u0430\u043d\u0434\u0443 <b>mul<\/b>, \u043d\u0435\u0437\u0430\u0432\u0438\u0441\u0438\u043c\u043e \u043e\u0442 \u0442\u0438\u043f\u043e\u0432 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432. \u0427\u0442\u043e\u0431\u044b \u0443\u0433\u043e\u0432\u043e\u0440\u0438\u0442\u044c \u0435\u0433\u043e \u0432\u044b\u0437\u0432\u0430\u0442\u044c \u043e\u0441\u0442\u0430\u043b\u044c\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438, \u043d\u0430\u0434\u043e \u043f\u0440\u0435\u043e\u0431\u0440\u0430\u0437\u043e\u0432\u0430\u0442\u044c \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0432 64-\u0431\u0438\u0442\u043d\u044b\u0435 \u0438 \u0432\u0437\u044f\u0442\u044c \u0441\u0442\u0430\u0440\u0448\u0438\u0435 32 \u0431\u0438\u0442\u0430. \u0412\u043e\u043e\u0431\u0449\u0435 \u0432 \u043c\u0430\u043d\u0443\u0430\u043b\u0435 \u0441\u043e\u0432\u0435\u0442\u0443\u044e\u0442 \u0432\u044b\u0437\u044b\u0432\u0430\u0442\u044c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0441\u043d\u0430\u0447\u0430\u043b\u0430 \u0434\u043b\u044f \u0441\u0442\u0430\u0440\u0448\u0438\u0445 32 \u0431\u0438\u0442 \u0438 \u043a\u044d\u0448\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u0447\u0442\u043e\u0431\u044b \u043c\u043b\u0430\u0434\u0448\u0438\u0435 32 \u0431\u0438\u0442\u0430 \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c \u0431\u044b\u0441\u0442\u0440\u043e, \u043d\u043e \u0443 \u043d\u0430\u0441 \u043a\u044d\u0448\u0430 \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u0422\u0430\u043a \u0432\u043e\u0442, \u043f\u043e\u0441\u043a\u043e\u043b\u044c\u043a\u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f \u043c\u043b\u0430\u0434\u0448\u0438\u0445 \u0431\u0438\u0442 \u043d\u0435 \u0437\u0430\u0432\u0438\u0441\u0438\u0442 \u043e\u0442 \u0442\u0438\u043f\u0430 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432, \u0442\u0435\u043e\u0440\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0435\u0451 \u043c\u043e\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u0434\u0430 \u0434\u0435\u043b\u0430\u0442\u044c \u043a\u0430\u043a \u0434\u043b\u044f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445, \u043d\u043e \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0447\u0438\u0441\u043b\u0430 \u043e\u0431\u044b\u0447\u043d\u043e \u043d\u0435\u0431\u043e\u043b\u044c\u0448\u0438\u0435, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u043b\u0443\u0447\u0448\u0435 \u0438\u0437\u0431\u0430\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u0442 \u043b\u0438\u0448\u043d\u0438\u0445 \u0435\u0434\u0438\u043d\u0438\u0446 \u0432 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0431\u0438\u0442\u0430\u0445 \u0438 \u0432\u0437\u044f\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u0447\u0438\u0441\u043b\u0430. \u041a\u0440\u043e\u043c\u0435 \u0442\u043e\u0433\u043e, \u044d\u0442\u043e \u043d\u0430\u0434\u043e \u0434\u043b\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f. <\/p>\n<pre><code class=\"vhdl\">wire need_restore_sign = is_op_multiply ? is_op_mul_signed : is_op_div_signed; wire start_muldiv_sign = need_restore_sign ? reg_s1[31] ^ reg_s2[31] : 1'b0; \/\/ = sign(x) * sign(y) wire rem_sign_start = need_restore_sign ? reg_s1[31] : 1'b0; \/\/ = sign(x) wire [31:0] start_x = (need_restore_sign &amp;&amp; $signed(reg_s1) &lt; 0) ? -reg_s1 : reg_s1; wire [31:0] start_y = (need_restore_sign &amp;&amp; $signed(reg_s2) &lt; 0) ? -reg_s2 : reg_s2; <\/code><\/pre>\n<p> \u0412 \u0441\u043b\u0443\u0447\u0430\u0435 \u043c\u043d\u043e\u0433\u043e\u0442\u0430\u043a\u0442\u043e\u0432\u043e\u0433\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b, \u0434\u043b\u044f \u0438\u0445 \u044d\u043a\u043e\u043d\u043e\u043c\u0438\u0438 \u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u0432\u0445\u043e\u0434\u044b \u0438 \u0432\u044b\u0445\u043e\u0434\u044b. \u041d\u0430\u0434\u043e \u0431\u0443\u0434\u0435\u0442 \u043a\u0430\u043a-\u0442\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0442\u044c, \u0447\u0442\u043e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0443\u0436\u0435 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u0442\u0441\u044f \u0438 \u043d\u0435 \u043d\u0430\u0434\u043e \u0437\u0430\u0442\u0438\u0440\u0430\u0442\u044c \u0432\u0441\u0451 \u0441\u0442\u0430\u0440\u0442\u043e\u0432\u044b\u043c\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438. \u0415\u0449\u0451 \u043d\u0430 \u0432\u0441\u044f\u043a\u0438\u0439 \u0441\u043b\u0443\u0447\u0430\u0439 \u043c\u043e\u0436\u043d\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u0438\u0442\u044c \u0444\u043b\u0430\u0433\u0438, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a\u0430 \u043d\u0430 \u0432\u044b\u0445\u043e\u0434\u0435. \u0421\u0435\u0439\u0447\u0430\u0441 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u0435 \u043c\u043e\u0434\u0443\u043b\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u044c\u043d\u044b, \u043d\u043e \u0432\u0434\u0440\u0443\u0433 \u043d\u0430\u0441\u0442\u0443\u043f\u0438\u0442 \u0433\u0438\u043f\u0435\u0440\u0442\u0440\u0435\u0434\u0438\u043d\u0433 )). <\/p>\n<pre><code class=\"vhdl\">\/\/\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043d\u0430\u0440\u0443\u0436\u0438, \u0435\u0451 \u043d\u0430\u0434\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \/\/\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 reg [31:0] x, y, r1, r2, r3; \/\/\u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f reg in_progress; \/\/\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u044f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445, \u0437\u043d\u0430\u043a \u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 reg muldiv_sign; \/\/\u0434\u043b\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e reg rem_sign; <\/code><\/pre>\n<p> \u0415\u0449\u0451 \u043d\u0430\u0434\u043e \u0443\u0447\u0435\u0441\u0442\u044c, \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044c \u0433\u0434\u0435-\u0442\u043e \u043d\u043e\u043b\u044c, \u0442\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043d\u0435 \u043f\u043e\u043d\u0430\u0434\u043e\u0431\u044f\u0442\u0441\u044f. <\/p>\n<pre><code class=\"vhdl\">wire need_wait = is_op_muldiv &amp;&amp; reg_s1 &amp;&amp; reg_s2; <\/code><\/pre>\n<p> \u0422\u0435\u043f\u0435\u0440\u044c \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u043a \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430\u043c. \u0422\u0443\u0442 \u0431\u044b\u043b\u043e \u0431\u044b \u0436\u0435\u043b\u0430\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u043e\u0432\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0445\u043e\u0442\u044f \u0431\u044b \u0433\u0434\u0435-\u0442\u043e \u0441\u043e\u0432\u043f\u0430\u043b\u0430 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0441\u0434\u0432\u0438\u0433\u0430, \u043f\u043e\u0442\u043e\u043c\u0443 \u0447\u0442\u043e \u043e\u043d\u0430 \u0442\u0443\u0442 \u043f\u043e\u0432\u0441\u044e\u0434\u0443, \u043d\u043e \u043a\u0430\u043a \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u0441\u044f.<br \/> \u0414\u043b\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u043e\u0434\u0438\u043d \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c \u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432\u043b\u0435\u0432\u043e \u0438 \u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u0434\u043e\u0431\u0430\u0432\u043a\u0443 \u043d\u0430 \u0435\u0433\u043e \u043d\u0443\u043b\u0435\u0432\u043e\u0439 \u0431\u0438\u0442, \u0432\u0442\u043e\u0440\u043e\u0439 \u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044c \u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432\u043f\u0440\u0430\u0432\u043e \u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0434\u043e\u0431\u0430\u0432\u043a\u0438.<br \/> \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445: {r3, r2} = {r1 = sign, x} * y <\/p>\n<pre><code class=\"vhdl\">wire [31:0] next_mul_y = (y &gt;&gt; 1); \/\/\u043f\u043e\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 wire [63:0] current_mul_x = {r1, x}; \/\/\u0431\u0435\u0440\u0451\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 x wire [63:0] next_mul_x = current_mul_x &lt;&lt; 1; \/\/\u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c wire [63:0] next_mul_val = {r3, r2} + (y[0] ? current_mul_x : 0); \/\/\u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 wire mul_end = next_mul_y == 0; \/\/\u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f <\/code><\/pre>\n<p> \u0414\u043b\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0432\u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0431\u0438\u0442\u044b \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e, \u043f\u043e\u043a\u0430 \u043d\u0435 \u0437\u0430\u043a\u043e\u043d\u0447\u0430\u0442\u0441\u044f. \u0414\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u043d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0432\u044b\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0431\u0438\u0442 \u0432 \u043e\u0434\u043d\u043e\u043c \u0438\u0437 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432, \u043f\u043e\u0442\u043e\u043c \u0434\u0432\u0438\u0433\u0430\u0435\u043c \u0432\u043b\u0435\u0432\u043e \u0432\u0435\u0441\u044c \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0438 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0435\u043c \u043f\u043e\u0431\u0438\u0442\u043e\u0432\u043e\u0435 \u00ab\u0418\u00bb \u043c\u0435\u0436\u0434\u0443 \u044d\u0442\u0438\u043c \u00ab\u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440\u043e\u043c\u00bb \u0438 \u0434\u0435\u043b\u0438\u043c\u044b\u043c.<br \/> \u0420\u0430\u0441\u043f\u043e\u043b\u043e\u0436\u0435\u043d\u0438\u0435 \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0445: {r3=q, r2=rem} = x \/ y, r1=msb (msb \u2014 most significant bit, \u043e\u043d \u0436\u0435 \u0438\u0442\u0435\u0440\u0430\u0442\u043e\u0440)<br \/> \u041d\u0430 \u0441\u0442\u0430\u0440\u0442\u0435 \u0434\u043b\u044f \u043e\u043f\u0442\u0438\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u043b\u0438\u0448\u043d\u0438\u0435 \u043d\u0443\u043b\u0438. <\/p>\n<pre><code class=\"vhdl\">wire [31:0] start_msb = start_x[31:24] != 8'b0 ? (1 &lt;&lt; 31) : \/\/\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u0446\u0438\u043a\u043b\u0430 start_x[23:16] != 8'b0 ? (1 &lt;&lt; 23) : start_x[15:8] != 8'b0 ? (1 &lt;&lt; 15) : (1 &lt;&lt; 7);  \/\/\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \/\/y (\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c) \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u043c \/\/x (\u0434\u0435\u043b\u0438\u043c\u043e\u0435) \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u043c wire [31:0] current_msb = r1; wire [31:0] current_rem = r2; wire [31:0] current_div_val = r3; wire [31:0] next_msb = (current_msb &gt;&gt; 1); \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e wire [31:0] next_rem_tmp = {current_rem[30:0], current_msb &amp; x ? 1'b1 : 1'b0}; \/\/ \u043f\u0440\u0438\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a \u043e\u0441\u0442\u0430\u0442\u043a\u0443 \/\/\u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u0435\u043d (\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c), \u0442\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \/\/\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0446\u0438\u0444\u0440\u0443 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0432\u043e\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 wire [31:0] div_remainder_delta = next_rem_tmp - y; wire [31:0] next_rem_val = $signed(div_remainder_delta) &gt;= 0 ? div_remainder_delta : next_rem_tmp; wire [31:0] next_div_val = {current_div_val[30:0], ~div_remainder_delta[31]}; \/\/\u043f\u0440\u0438\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434 \u043a \u0447\u0430\u0441\u0442\u043d\u043e\u043c\u0443 wire div_end = next_msb == 0; <\/code><\/pre>\n<p> \u0410\u043b\u043e\u0440\u0438\u0442\u043c\u044b \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0435\u0441\u0442\u044c, \u0442\u0435\u043f\u0435\u0440\u044c \u0438\u0445 \u0432\u044b\u0445\u043e\u0434\u044b \u043d\u0430\u0434\u043e \u0441\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u043e\u0432\u0430\u0442\u044c, \u0447\u0442\u043e\u0431\u044b \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b. <\/p>\n<pre><code class=\"vhdl\">wire [31:0] start_r1 = !is_op_multiply ? start_msb : is_op_mul_extend_sign ? (reg_s1[31] ? -1 : 0) : 0;  wire [31:0] next_x = is_op_multiply ? next_mul_x[31:0] : x; wire [31:0] next_y = is_op_multiply ? next_mul_y : y; wire [31:0] next_r1 = is_op_multiply ? next_mul_x[63:32] : next_msb; wire [31:0] next_r2 = is_op_multiply ? next_mul_val[31:0] : next_rem_val; wire [31:0] next_r3 = is_op_multiply ? next_mul_val[63:32] : next_div_val; wire divmul_end = is_op_multiply ? mul_end : div_end; \/\/\u0431\u043b\u043e\u043a \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c wire next_in_progress = in_progress &amp;&amp; !divmul_end; \/\/\u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u043e\u043d\u0438\u043b, \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0431\u043b\u043e\u043a\u0430 <\/code><\/pre>\n<p> \u041f\u043e\u0441\u043b\u0435 \u0442\u043e\u0433\u043e \u043a\u0430\u043a \u0430\u043b\u043e\u0440\u0438\u0442\u043c\u044b \u043e\u0442\u0440\u0430\u0431\u043e\u0442\u0430\u044e\u0442, \u043d\u0430\u0434\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u043a\u043e\u043d\u0435\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/p>\n<pre><code class=\"vhdl\">wire [63:0] mul_result = muldiv_sign ? -next_mul_val : next_mul_val; wire [31:0] div_result = muldiv_sign ? -next_div_val : next_div_val; wire [31:0] rem_result = rem_sign ? -next_rem_val : next_rem_val; wire [31:0] rd_mul = !in_progress ? 0 : \/\/\u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0442\u0430\u043a\u0442\u0435 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u043b\u044c !divmul_end ? 0 : \/\/\u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0434\u0451\u0442, \u043d\u0435 \u043a\u0430\u0447\u0430\u0435\u043c \u0437\u0430\u0442\u0432\u043e\u0440\u044b op_funct3 == 3'd0 ? mul_result[31:0] : \/\/mul op_funct3 == 3'd1 ? mul_result[63:32] : \/\/mulh op_funct3 == 3'd2 ? mul_result[63:32] : \/\/mulsu op_funct3 == 3'd3 ? mul_result[63:32] : \/\/mulu op_funct3 == 3'd4 ? div_result : \/\/div op_funct3 == 3'd5 ? div_result : \/\/divu op_funct3 == 3'd6 ? rem_result : \/\/rem \/*op_funct3 == 7 ?*\/ rem_result;  \/\/remu  assign is_alu_wait = !in_progress ? need_wait : !divmul_end; <\/code><\/pre>\n<p> \u0412\u0441\u0435 \u0440\u0430\u0441\u0447\u0451\u0442\u044b \u043f\u0440\u043e\u0432\u0435\u0434\u0435\u043d\u044b, \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u0437\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u0432 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043f\u0440\u043e\u043c\u0435\u0436\u0443\u0442\u043e\u0447\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f. <\/p>\n<pre><code class=\"vhdl\">wire divmul_active = need_wait || in_progress; always@(posedge clock or posedge reset) begin if (reset == 1) begin x &lt;= 0; y &lt;= 0; r1 &lt;= 0; r2 &lt;= 0; r3 &lt;= 0; in_progress &lt;= 0; end else if (divmul_active) begin if (!in_progress) begin \/\/ \u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0442\u0430\u043a\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f in_progress &lt;= 1'b1; x &lt;= start_x; y &lt;= start_y; r1 &lt;= start_r1; \/\/\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043e\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u0437\u043d\u0430\u043a\u043e\u043c \u0434\u043e 64 \u0431\u0438\u0442 \u0438\u043b\u0438 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0446\u0438\u043a\u043b\u0430 r2 &lt;= 0; \/\/\u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a r3 &lt;= 0; \/\/\u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0447\u0430\u0441\u0442\u043d\u043e\u0435 muldiv_sign &lt;= start_muldiv_sign; \/\/\u043d\u0430\u0434\u043e \u043b\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u043a rem_sign &lt;= rem_sign_start; end else begin in_progress = next_in_progress; x &lt;= next_x; y &lt;= next_y; r1 &lt;= next_r1; r2 &lt;= next_r2; r3 &lt;= next_r3; end end end  \/\/\u0432\u044b\u0434\u0430\u0451\u043c \u043d\u0430\u0440\u0443\u0436\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 assign rd_alu = is_op_muldiv ? rd_mul : rd_alu1; <\/code><\/pre>\n<p> \u0424\u0430\u0439\u043b\u044b \u0446\u0435\u043b\u0438\u043a\u043e\u043c <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">core.v<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vhdl\">\/\/ \u044f\u0434\u0440\u043e risc-v \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430  \/\/ \u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 rv32i `define opcode_load        7'b00000_11 \/\/I \/\/l**   rd,  rs1,imm     rd = m[rs1 + imm]; load bytes `define opcode_store       7'b01000_11 \/\/S \/\/s**   rs1, rs2,imm     m[rs1 + imm] = rs2; store bytes `define opcode_alu         7'b01100_11 \/\/R \/\/***   rd, rs1, rs2     rd = rs1 x rs2; arithmetical `define opcode_alu_imm     7'b00100_11 \/\/I \/\/***   rd, rs1, imm     rd = rs1 x imm; arithmetical with immediate `define opcode_load_upper  7'b01101_11 \/\/U \/\/lui   rd, imm          rd = imm &lt;&lt; 12; load upper imm `define opcode_add_upper   7'b00101_11 \/\/U \/\/auipc rd, imm          rd = pc + (imm &lt;&lt; 12); add upper imm to PC `define opcode_branch      7'b11000_11 \/\/B \/\/b**   rs1, rs2, imm    if (rs1 x rs2) pc += imm `define opcode_jal         7'b11011_11 \/\/J \/\/jal   rd,imm   jump and link, rd = PC+4; PC += imm `define opcode_jalr        7'b11001_11 \/\/I \/\/jalr  rd,rs1,imm   jump and link reg, rd = PC+4; PC = rs1 + imm  `ifdef __RV32E__     `define REG_COUNT 16 \/\/\u0434\u043b\u044f embedded \u0447\u0438\u0441\u043b\u043e \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \u043c\u0435\u043d\u044c\u0448\u0435 `else     `define REG_COUNT 32 `endif  `include \"alu.v\"  module RiscVCore ( input clock, input reset, input irq,  output [31:0] instruction_address, input  [31:0] instruction_data,  output [31:0] data_address, output [1:0]  data_width, input  [31:0] data_in, output [31:0] data_out, output        data_read, output        data_write );  \/\/\u0431\u0430\u0437\u043e\u0432\u044b\u0439 \u043d\u0430\u0431\u043e\u0440 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 reg [31:0] regs [0:`REG_COUNT-1]; \/\/x0-x31 reg [31:0] pc; wire is_wait; \/\/\u043d\u0430 \u0442\u0435\u043a\u0443\u0449\u0435\u043c \u0442\u0430\u043a\u0442\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0435\u0449\u0451 \u043d\u0435 \u0433\u043e\u0442\u043e\u0432\u0430  \/\/\u0434\u043e\u0441\u0442\u0430\u0451\u043c \u0438\u0437 pc \u0430\u0434\u0440\u0435\u0441 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 \u0438 \u043f\u043e\u0441\u044b\u043b\u0430\u0435\u043c \u0432 \u0448\u0438\u043d\u0443 assign instruction_address = pc;  \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0438\u0437 \u0448\u0438\u043d\u044b \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e wire [31:0] instruction = instruction_data;  \/\/\u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u043a\u043e\u0434 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 wire[6:0] op_code = instruction[6:0]; \/\/\u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 wire[4:0] op_rd = instruction[11:7]; \/\/\u0432\u044b\u0445\u043e\u0434\u043d\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440 wire[2:0] op_funct3 = instruction[14:12]; \/\/\u043f\u043e\u0434\u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 wire[4:0] op_rs1 = instruction[19:15]; \/\/\u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 1 wire[4:0] op_rs2 = instruction[24:20]; \/\/\u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u043e\u043f\u0435\u0440\u0430\u043d\u0434 2 wire[6:0] op_funct7 = instruction[31:25]; wire[31:0] op_immediate_i = {{20{instruction[31]}}, instruction[31:20]}; \/\/\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 I-\u0442\u0438\u043f\u0430 wire[31:0] op_immediate_s = {{20{instruction[31]}}, instruction[31:25], instruction[11:7]}; \/\/\u0432\u0441\u0442\u0440\u043e\u0435\u043d\u043d\u044b\u0435 \u0434\u0430\u043d\u043d\u044b\u0435 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 S-\u0442\u0438\u043f\u0430 wire[31:0] op_immediate_u = {instruction[31:12], 12'b0}; wire[31:0] op_immediate_b = {{20{instruction[31]}}, instruction[7],                               instruction[30:25], instruction[11:8], 1'b0}; wire[31:0] op_immediate_j = {{12{instruction[31]}}, instruction[19:12],                               instruction[20], instruction[30:21], 1'b0};  \/\/\u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u0440\u0430\u0431\u043e\u0442\u0430\u0432\u0448\u0443\u044e \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e wire is_op_load = op_code == `opcode_load; wire is_op_store = op_code == `opcode_store; wire is_op_alu = op_code == `opcode_alu; wire is_op_alu_imm = op_code == `opcode_alu_imm; wire is_op_load_upper = op_code == `opcode_load_upper; wire is_op_add_upper = op_code == `opcode_add_upper; wire is_op_branch = op_code == `opcode_branch; wire is_op_jal = op_code == `opcode_jal; wire is_op_jalr = op_code == `opcode_jalr;  wire error_opcode = !(is_op_load || is_op_store ||                     is_op_alu || is_op_alu_imm ||                     is_op_load_upper || is_op_add_upper ||                     is_op_branch || is_op_jal || is_op_jalr);  \/\/\u043a\u0430\u043a\u043e\u0439 \u0444\u043e\u0440\u043c\u0430\u0442 \u0443 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 wire type_r = is_op_alu; wire type_i = is_op_alu_imm || is_op_load || is_op_jalr; wire type_s = is_op_store; wire type_b = is_op_branch; wire type_u = is_op_load_upper || is_op_add_upper; wire type_j = is_op_jal;  \/\/\u043c\u0443\u043b\u044c\u0442\u0438\u043f\u043b\u0435\u043a\u0441\u0438\u0440\u0443\u0435\u043c \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u044b wire [31:0] immediate = type_i ? op_immediate_i : type_s ? op_immediate_s : type_b ? op_immediate_b : type_j ? op_immediate_j : type_u ? op_immediate_u : 0;  \/\/\u043f\u043e\u043b\u0443\u0447\u0430\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0438\u0437 \u0430\u0434\u0440\u0435\u0441\u043e\u0432 \/\/wire [31:0] reg_d = regs[op_rd]; wire [31:0] reg_s1 = regs[op_rs1]; wire [31:0] reg_s2 = regs[op_rs2]; wire signed [31:0] reg_s1_signed = reg_s1; wire signed [31:0] reg_s2_signed = reg_s2;   \/\/\u0447\u0442\u0435\u043d\u0438\u0435 \u043f\u0430\u043c\u044f\u0442\u0438 (lb, lh, lw, lbu, lhu), I-\u0442\u0438\u043f assign data_read = is_op_load; wire load_signed = ~op_funct3[2]; wire [31:0] rd_load = op_funct3[1:0] == 0 ? {{24{load_signed &amp; data_in[7]}}, data_in[7:0]} : \/\/0-byte                       op_funct3[1:0] == 1 ? {{16{load_signed &amp; data_in[15]}}, data_in[15:0]} : \/\/1-half                       data_in; \/\/2-word  \/\/\u0437\u0430\u043f\u0438\u0441\u044c \u043f\u0430\u043c\u044f\u0442\u0438 (sb, sh, sw), S-\u0442\u0438\u043f assign data_write = is_op_store; assign data_out = is_op_store ? reg_s2 : 0;  \/\/\u043e\u0431\u0449\u0435\u0435 \u0434\u043b\u044f \u0447\u0442\u0435\u043d\u0438\u044f \u0438 \u0437\u0430\u043f\u0438\u0441\u0438 assign data_address = (is_op_load || is_op_store) ? reg_s1 + immediate : 0; assign data_width = (is_op_load || is_op_store) ? op_funct3[1:0] : 'b11; \/\/0-byte, 1-half, 2-word  \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0430\u0440\u0438\u0444\u043c\u0435\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 \/\/(add, sub, xor, or, and, sll, srl, sra, slt, sltu) \/\/(mul, mulh, mulsu, mulu, div, divu, rem, remu) wire [31:0] rd_alu; wire is_alu_wait; RiscVAlu alu( .clock(clock), .reset(reset), .is_op_alu(is_op_alu), .is_op_alu_imm(is_op_alu_imm), .op_funct3_in(op_funct3), .op_funct7(op_funct7), .reg_s1(reg_s1), .reg_s2(reg_s2), .imm(immediate), .rd_alu(rd_alu), .is_alu_wait(is_alu_wait) );  \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 upper immediate wire [31:0] rd_load_upper = immediate; \/\/lui wire [31:0] rd_add_upper = pc + immediate; \/\/auipc  \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 \u0432\u0435\u0442\u0432\u043b\u0435\u043d\u0438\u0439 wire [31:0] pc_branch = pc + immediate; wire branch_fired = op_funct3 == 0 &amp;&amp; reg_s1 == reg_s2 || \/\/beq                     op_funct3 == 1 &amp;&amp; reg_s1 != reg_s2 || \/\/bne                     op_funct3 == 4 &amp;&amp; reg_s1_signed &lt;  reg_s2_signed || \/\/blt                     op_funct3 == 5 &amp;&amp; reg_s1_signed &gt;= reg_s2_signed || \/\/bge                     op_funct3 == 6 &amp;&amp; reg_s1 &lt;  reg_s2 || \/\/bltu                     op_funct3 == 7 &amp;&amp; reg_s1 &gt;= reg_s2; \/\/bgeu  \/\/\u043a\u043e\u0440\u043e\u0442\u043a\u0438\u0435 \u0438 \u0434\u043b\u0438\u043d\u043d\u044b\u0435 \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u044b (jal, jalr) wire [31:0] rd_jal = pc + 4; wire [31:0] pc_jal = pc + immediate; wire [31:0] pc_jalr = reg_s1 + immediate;  \/\/\u0442\u0435\u043f\u0435\u0440\u044c \u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b \u043b\u043e\u0433\u0438\u043a\u0438 \u0440\u0430\u0437\u043d\u044b\u0445 \u043a\u043e\u043c\u0430\u043d\u0434 wire [31:0] rd_result = op_rd == 0 ? 0 : \/\/x0 = 0 is_op_load ? rd_load : is_op_alu || is_op_alu_imm ? rd_alu : is_op_load_upper ? rd_load_upper : is_op_add_upper ? rd_add_upper : is_op_jal || is_op_jalr ? rd_jal : regs[op_rd];  wire [31:0] pc_result = (is_op_branch &amp;&amp; branch_fired) ? pc_branch : is_op_jal ? pc_jal : is_op_jalr ? pc_jalr : pc + 4;  assign is_wait = is_alu_wait;  integer i; always@(posedge clock or posedge reset) begin if (reset == 1) begin for (i = 0; i &lt; `REG_COUNT; i=i+1) regs[i] = 0; pc = 0; end else if (!is_wait) begin regs[op_rd] &lt;= rd_result; pc &lt;= pc_result; end end endmodule <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> <\/p>\n<div class=\"spoiler\" role=\"button\" tabindex=\"0\">                         <b class=\"spoiler_title\">alu.v<\/b>                         <\/p>\n<div class=\"spoiler_text\">\n<pre><code class=\"vhdl\">`define FAST_MULDIV \/\/ \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u0437\u0430 \u043e\u0434\u0438\u043d \u0442\u0430\u043a\u0442  module RiscVAlu ( input clock, input reset,  input is_op_alu, \/\/\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441 \u0434\u0432\u0443\u043c\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u043c\u0438 input is_op_alu_imm, \/\/\u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044f \u0441 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u043c \u0438 \u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u043e\u0439 input [2:0] op_funct3_in, \/\/\u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 input [6:0] op_funct7, \/\/\u043a\u043e\u0434 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0438 input [31:0] reg_s1, \/\/\u043f\u0435\u0440\u0432\u044b\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440-\u043e\u043f\u0435\u0440\u0430\u043d\u0434 input [31:0] reg_s2, \/\/\u0432\u0442\u043e\u0440\u043e\u0439 \u0440\u0435\u0433\u0438\u0441\u0442\u0440-\u043e\u043f\u0435\u0440\u0430\u043d\u0434 input [31:0] imm, \/\/\u043a\u043e\u043d\u0441\u0442\u0430\u043d\u0442\u0430-\u043e\u043f\u0435\u0440\u0430\u043d\u0434 output [31:0] rd_alu, \/\/\u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0440\u0430\u0431\u043e\u0442\u044b output is_alu_wait \/\/\u043d\u0430\u0434\u043e \u043b\u0438 \u0436\u0434\u0430\u0442\u044c \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u044e \u0434\u043e \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0433\u043e \u0442\u0430\u043a\u0442\u0430 );  \/\/\u043d\u0435\u043c\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0432\u0445\u043e\u0434\u043e\u0432 wire [2:0] op_funct3_a = (is_op_alu || is_op_alu_imm) ? op_funct3_in : 3'b0;  \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 (add, sub, xor, or, and, sll, srl, sra, slt, sltu) \/\/\u0432 \u0441\u043b\u0443\u0447\u0430\u0435 \u043b\u0451\u0433\u043a\u0438\u0445 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0439 \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0435\u043c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u0441\u0440\u0430\u0437\u0443 wire [31:0] alu_operand2 = is_op_alu ? reg_s2 : is_op_alu_imm ? imm : 0; wire [31:0] rd_alu1 = op_funct3_a == 3'd0 ? (is_op_alu &amp;&amp; op_funct7[5] ? reg_s1 - alu_operand2 : reg_s1 + alu_operand2) :   op_funct3_a == 3'd4 ? reg_s1 ^ alu_operand2 :   op_funct3_a == 3'd6 ? reg_s1 | alu_operand2 :   op_funct3_a == 3'd7 ? reg_s1 &amp; alu_operand2 :   op_funct3_a == 3'd1 ? reg_s1 &lt;&lt; alu_operand2[4:0] :   op_funct3_a == 3'd5 ? (op_funct7[5] ? $signed(reg_s1) &gt;&gt;&gt; alu_operand2[4:0] : reg_s1 &gt;&gt; alu_operand2[4:0]) :   op_funct3_a == 3'd2 ? $signed(reg_s1) &lt; $signed(alu_operand2) :   op_funct3_a == 3'd3 ? reg_s1 &lt; alu_operand2 : \/\/TODO \u0434\u043b\u044f \u0431\u043e\u043b\u044c\u0448\u0438\u0445 imm \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c   0; \/\/\u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u044b\u0439 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442  \/\/ \u0420\u0410\u0421\u0428\u0418\u0420\u0415\u041d\u0418\u0415 M \/\/\u043e\u0431\u0440\u0430\u0431\u043e\u0442\u043a\u0430 (mul, mulh, mulhsu, mulu, div, divu, rem, remu) \/\/\u0440\u0430\u0441\u0448\u0438\u0444\u0440\u043e\u0432\u044b\u0432\u0430\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e wire is_op_muldiv = is_op_alu &amp;&amp; op_funct7[0]; wire [2:0] op_funct3 = is_op_muldiv ? op_funct3_in : 3'b0; \/\/\u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0430\u044f \u0441\u0442\u0430\u0431\u0438\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u0434\u043b\u044f \u043c\u043e\u0434\u0443\u043b\u044f M wire is_op_multiply = !op_funct3[2]; wire is_op_mul_signed = !op_funct3[1]; \/\/mul, mulh \/\/wire is_op_mul_low = op_funct3[1:0] == 0; \/\/mul wire is_op_mul_extend_sign = op_funct3[1:0] == 2; \/\/mulhsu \/\/\u0443\u043c\u043d\u043e\u0436\u0430\u0435\u043c \u043a\u0430\u043a \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0435, \u043d\u043e \u0441\u0430\u043c \u0437\u043d\u0430\u043a \u043d\u0430\u0434\u043e \u0440\u0430\u0441\u0448\u0438\u0440\u0438\u0442\u044c \u0434\u043e 64 \u0431\u0438\u0442 wire is_op_div_signed = !op_funct3[0]; \/\/div, rem \/\/wire is_op_remainder = op_funct3[2]; \/\/rem, remu  \/\/\u0434\u043b\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u043e \u0437\u043d\u0430\u043a\u043e\u043c \u0434\u043e\u0441\u0442\u0430\u0442\u043e\u0447\u043d\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u0437\u043d\u0430\u043a \u0443 \u043a\u043e\u0440\u043e\u0442\u043a\u043e\u0433\u043e \u0441\u043e\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \/\/\u043d\u043e \u0434\u043b\u044f \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043d\u0430\u0434\u043e \u0443\u0431\u0440\u0430\u0442\u044c \u0443 \u043e\u0431\u043e\u0438\u0445, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0434\u0438\u043d\u043e\u043e\u0431\u0440\u0430\u0437\u043d\u043e wire need_restore_sign = is_op_multiply ? is_op_mul_signed : is_op_div_signed; wire start_muldiv_sign = need_restore_sign ? reg_s1[31] ^ reg_s2[31] : 1'b0; \/\/ = sign(x) * sign(y) wire rem_sign_start = need_restore_sign ? reg_s1[31] : 1'b0; \/\/ = sign(x) wire [31:0] start_x = (need_restore_sign &amp;&amp; $signed(reg_s1) &lt; 0) ? -reg_s1 : reg_s1; wire [31:0] start_y = (need_restore_sign &amp;&amp; $signed(reg_s2) &lt; 0) ? -reg_s2 : reg_s2;  `ifdef FAST_MULDIV  assign is_alu_wait = 0; wire [31:0] quotient; wire [31:0] remainder; wire [31:0] mul_1; wire [31:0] mul_2;  RiscVFastDiv fd( .x(start_x), .y(start_y), .quotient(quotient), .remainder(remainder) );  assign {mul_2, mul_1} = start_x * start_y;  \/\/ \u0435\u0441\u043b\u0438 \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u043c: -a * b = ((1&lt;&lt;32)-a) * b = -a * b + (b &lt;&lt; 32) \/\/ \u0434\u043b\u044f \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u0438\u044f mulhsu \u043d\u0430\u0434\u043e \u043f\u043e\u0441\u043b\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0432\u044b\u0447\u0438\u0442\u0430\u043d\u0438\u0435 \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u043e\u0433\u043e \u0438\u0437 \u0441\u0442\u0430\u0440\u0448\u0438\u0445 \u0440\u0430\u0437\u0440\u044f\u0434\u043e\u0432 wire [31:0] mulhsu = mul_2 - (reg_s1[31] ? reg_s2 : 0); wire [63:0] mul_result = start_muldiv_sign ? -{mul_2, mul_1} : {mul_2, mul_1}; wire [31:0] quotient_signed = start_muldiv_sign ? -quotient : quotient; wire [31:0] remainder_signed = rem_sign_start ? -remainder : remainder; wire [31:0] rd_mul = op_funct3 == 3'd0 ? mul_result[31:0] : \/\/mul op_funct3 == 3'd1 ? mul_result[63:32] : \/\/mulh op_funct3 == 3'd2 ? mulhsu            : \/\/mulhsu op_funct3 == 3'd3 ? mul_result[63:32] : \/\/mulu op_funct3 == 3'd4 ? quotient_signed :   \/\/div op_funct3 == 3'd5 ? quotient_signed :   \/\/divu op_funct3 == 3'd6 ? remainder_signed :  \/\/rem \/*op_funct3 == 7 ?*\/ remainder_signed;  \/\/remu  `else  \/\/\u043f\u0440\u0438 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0438 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u043f\u0435\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u043e\u0433\u0443\u0442 \u043c\u0435\u043d\u044f\u0442\u044c\u0441\u044f, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0438\u0445 \u043b\u043e\u043a\u0430\u043b\u044c\u043d\u043e \/\/\u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u0442\u0441\u044f \u0441\u043d\u0430\u0440\u0443\u0436\u0438, \u0435\u0451 \u043d\u0430\u0434\u043e \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u0442\u044c \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0431\u043b\u043e\u043a\u0430 \/\/\u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c \u0434\u043b\u044f \u043e\u0431\u043e\u0438\u0445 \u043e\u043f\u0435\u0440\u0430\u0446\u0438\u0439 reg [31:0] x, y, r1, r2, r3; \/\/\u043f\u043e\u0441\u043b\u0435 \u043d\u0430\u0447\u0430\u043b\u0430 \u0440\u0430\u0431\u043e\u0442\u044b \u043d\u0435 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u043c\u0441\u044f \u043d\u0430 \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f reg in_progress; \/\/\u0441\u0447\u0438\u0442\u0430\u0435\u043c \u0434\u043b\u044f \u0431\u0435\u0437\u0437\u043d\u0430\u043a\u043e\u0432\u044b\u0445, \u0437\u043d\u0430\u043a \u043c\u0435\u043d\u044f\u0435\u043c \u0432 \u043a\u043e\u043d\u0446\u0435 reg muldiv_sign; \/\/\u0434\u043b\u044f \u043e\u0441\u0442\u0430\u0442\u043a\u0430 \u043e\u0442 \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u0437\u043d\u0430\u043a \u0431\u0435\u0440\u0451\u0442\u0441\u044f \u0438\u0437 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e reg rem_sign;  \/\/\u0435\u0441\u043b\u0438 \u0445\u043e\u0442\u044c \u0433\u0434\u0435-\u0442\u043e \u043d\u043e\u043b\u044c, \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043c\u043e\u0436\u043d\u043e \u0432\u044b\u0434\u0430\u0442\u044c \u0441\u0440\u0430\u0437\u0443 wire need_wait = is_op_muldiv &amp;&amp; reg_s1 &amp;&amp; reg_s2;  \/\/\u0438\u043d\u0438\u0446\u0438\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u0435\u043c \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044e \/\/\u043f\u0435\u0440\u0435\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 {r3, r2} = {r1 = sign, x} * y \/\/\u0434\u0435\u043b\u0435\u043d\u0438\u0435 {r3=q, r2=rem} = x \/ y , r1=msb - \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0446\u0438\u043a\u043b\u0430, \u043e\u043d \u0436\u0435 \u0441\u0430\u043c\u044b\u0439 \u0437\u043d\u0430\u0447\u0438\u043c\u044b\u0439 \u0431\u0438\u0442  wire [31:0] start_msb = start_x[31:24] != 8'b0 ? (1 &lt;&lt; 31) : \/\/\u043b\u0435\u0433\u043a\u043e\u0432\u0435\u0441\u043d\u0430\u044f \u043f\u043e\u0434\u0433\u043e\u043d\u043a\u0430 \u043d\u0430\u0447\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u0446\u0438\u043a\u043b\u0430 start_x[23:16] != 8'b0 ? (1 &lt;&lt; 23) : start_x[15:8] != 8'b0 ? (1 &lt;&lt; 15) : (1 &lt;&lt; 7); wire [31:0] start_r1 = !is_op_multiply ? start_msb : is_op_mul_extend_sign ? (reg_s1[31] ? -1 : 0) : 0;  \/\/\u043e\u0431\u0440\u0430\u0431\u0430\u0442\u044b\u0432\u0430\u0435\u043c \u0432 \u0446\u0438\u043a\u043b\u0435 \/\/\u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 wire [31:0] next_mul_y = (y &gt;&gt; 1); \/\/\u043f\u043e\u0440\u0430\u0437\u0440\u044f\u0434\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 wire [63:0] current_mul_x = {r1, x}; \/\/\u0431\u0435\u0440\u0451\u043c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 x wire [63:0] next_mul_x = current_mul_x &lt;&lt; 1; \/\/\u0441\u0434\u0432\u0438\u0433\u0430\u0435\u043c wire [63:0] next_mul_val = {r3, r2} + (y[0] ? current_mul_x : 0); \/\/\u0438 \u043f\u0440\u0438\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043a \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0443 wire mul_end = next_mul_y == 0; \/\/\u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u043e\u043a\u043e\u043d\u0447\u0430\u043d\u0438\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f  \/\/\u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0432 \u0441\u0442\u043e\u043b\u0431\u0438\u043a \/\/y (\u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c) \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u043c \/\/x (\u0434\u0435\u043b\u0438\u043c\u043e\u0435) \u043d\u0435 \u043c\u0435\u043d\u044f\u0435\u043c wire [31:0] current_msb = r1; wire [31:0] current_rem = r2; wire [31:0] current_div_val = r3; wire [31:0] next_msb = (current_msb &gt;&gt; 1); \/\/ \u0432\u044b\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u0440\u0430\u0437\u0440\u044f\u0434 \u0434\u0435\u043b\u0438\u043c\u043e\u0433\u043e wire [31:0] next_rem_tmp = {current_rem[30:0], current_msb &amp; x ? 1'b1 : 1'b0}; \/\/ \u043f\u0440\u0438\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u043a \u043e\u0441\u0442\u0430\u0442\u043a\u0443 \/\/\u0435\u0441\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a \u0431\u043e\u043b\u044c\u0448\u0435 \u0438\u043b\u0438 \u0440\u0430\u0432\u0435\u043d (\u0442\u043e \u0435\u0441\u0442\u044c \u0434\u0435\u043b\u0438\u0442\u0441\u044f \u043d\u0430 \u0434\u0435\u043b\u0438\u0442\u0435\u043b\u044c), \u0442\u043e \u0432\u044b\u0447\u0438\u0442\u0430\u0435\u043c \/\/\u043a\u043e\u043d\u043a\u0440\u0435\u0442\u043d\u0443\u044e \u0446\u0438\u0444\u0440\u0443 \u043f\u043e\u0434\u0431\u0438\u0440\u0430\u0442\u044c \u043d\u0435 \u043d\u0430\u0434\u043e, \u0442\u0430\u043a \u043a\u0430\u043a \u0434\u0432\u043e\u0438\u0447\u043d\u0430\u044f \u0441\u0438\u0441\u0442\u0435\u043c\u0430 wire [31:0] div_remainder_delta = next_rem_tmp - y; wire [31:0] next_rem_val = $signed(div_remainder_delta) &gt;= 0 ? div_remainder_delta : next_rem_tmp; wire [31:0] next_div_val = {current_div_val[30:0], ~div_remainder_delta[31]}; \/\/\u043f\u0440\u0438\u043f\u0438\u0441\u044b\u0432\u0430\u0435\u043c \u0440\u0430\u0437\u0440\u044f\u0434 \u043a \u0447\u0430\u0441\u0442\u043d\u043e\u043c\u0443 wire div_end = next_msb == 0;  \/\/\u043a\u043e\u043c\u0431\u0438\u043d\u0438\u0440\u0443\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0434\u043b\u044f \u0437\u0430\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u043e\u0432 \/\/\u0432 \u0442\u0435\u043e\u0440\u0438\u0438 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u044b \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0441\u0442\u0430\u0432\u0438\u0442\u044c, \u0441\u0434\u0432\u0438\u0433 \u0438 \u0443\u0441\u043b\u043e\u0432\u0438\u0435 \u0432\u044b\u0445\u043e\u0434\u0430 \u043a\u0430\u0436\u0443\u0442\u0441\u044f \u043f\u043e\u0445\u043e\u0436\u0438\u043c\u0438 wire [31:0] next_x = is_op_multiply ? next_mul_x[31:0] : x; wire [31:0] next_y = is_op_multiply ? next_mul_y : y; wire [31:0] next_r1 = is_op_multiply ? next_mul_x[63:32] : next_msb; wire [31:0] next_r2 = is_op_multiply ? next_mul_val[31:0] : next_rem_val; wire [31:0] next_r3 = is_op_multiply ? next_mul_val[63:32] : next_div_val; wire divmul_end = is_op_multiply ? mul_end : div_end; \/\/\u0431\u043b\u043e\u043a \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0437\u0430\u043a\u043e\u043d\u0447\u0438\u043b \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u0442\u044c wire next_in_progress = in_progress &amp;&amp; !divmul_end; \/\/\u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043a\u043e\u043d\u0438\u043b, \u0432\u044b\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u0440\u0435\u0433\u0438\u0441\u0442\u0440 \u0430\u043a\u0442\u0438\u0432\u043d\u043e\u0441\u0442\u0438 \u0431\u043b\u043e\u043a\u0430  wire [63:0] mul_result = muldiv_sign ? -next_mul_val : next_mul_val; wire [31:0] div_result = muldiv_sign ? -next_div_val : next_div_val; wire [31:0] rem_result = rem_sign ? -next_rem_val : next_rem_val; wire [31:0] rd_mul = !in_progress ? 0 : \/\/\u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0442\u0430\u043a\u0442\u0435 \u0432\u0441\u0451 \u0440\u0430\u0432\u043d\u043e \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u043e\u043b\u044c !divmul_end ? 0 : \/\/\u043f\u043e\u043a\u0430 \u043f\u0440\u043e\u0446\u0435\u0441\u0441 \u0438\u0434\u0451\u0442, \u043d\u0435 \u043a\u0430\u0447\u0430\u0435\u043c \u0437\u0430\u0442\u0432\u043e\u0440\u044b op_funct3 == 3'd0 ? mul_result[31:0] : \/\/mul op_funct3 == 3'd1 ? mul_result[63:32] : \/\/mulh op_funct3 == 3'd2 ? mul_result[63:32] : \/\/mulsu op_funct3 == 3'd3 ? mul_result[63:32] : \/\/mulu op_funct3 == 3'd4 ? div_result : \/\/div op_funct3 == 3'd5 ? div_result : \/\/divu op_funct3 == 3'd6 ? rem_result : \/\/rem \/*op_funct3 == 7 ?*\/ rem_result;  \/\/remu  \/\/\u043a\u043e\u0433\u0434\u0430 \u043d\u0435\u043b\u044c\u0437\u044f \u043f\u0435\u0440\u0435\u0445\u043e\u0434\u0438\u0442\u044c \u043a \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0435\u0439 \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u0438 assign is_alu_wait = !in_progress ? need_wait : !divmul_end;  wire divmul_active = need_wait || in_progress; always@(posedge clock or posedge reset) begin if (reset == 1) begin x &lt;= 0; y &lt;= 0; r1 &lt;= 0; r2 &lt;= 0; r3 &lt;= 0; in_progress &lt;= 0; end else if (divmul_active) begin if (!in_progress) begin \/\/ \u043d\u0430 \u043d\u0443\u043b\u0435\u0432\u043e\u043c \u0442\u0430\u043a\u0442\u0435 \u043f\u0440\u043e\u0441\u0442\u043e \u0437\u0430\u043f\u043e\u043c\u0438\u043d\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f in_progress &lt;= 1'b1; x &lt;= start_x; y &lt;= start_y; r1 &lt;= start_r1; \/\/\u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u0435 \u043f\u0435\u0440\u0432\u043e\u0433\u043e \u0441\u043e\u043c\u043d\u043e\u0436\u0438\u0442\u0435\u043b\u044f \u0437\u043d\u0430\u043a\u043e\u043c \u0434\u043e 64 \u0431\u0438\u0442 \u0438\u043b\u0438 \u0441\u0447\u0451\u0442\u0447\u0438\u043a \u0446\u0438\u043a\u043b\u0430 r2 &lt;= 0; \/\/\u043c\u043b\u0430\u0434\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u043e\u0441\u0442\u0430\u0442\u043e\u043a r3 &lt;= 0; \/\/\u0441\u0442\u0430\u0440\u0448\u0438\u0435 \u0431\u0438\u0442\u044b \u043f\u0440\u043e\u0438\u0437\u0432\u0435\u0434\u0435\u043d\u0438\u044f \u0438\u043b\u0438 \u0447\u0430\u0441\u0442\u043d\u043e\u0435 muldiv_sign &lt;= start_muldiv_sign; \/\/\u043d\u0430\u0434\u043e \u043b\u0438 \u0432 \u043a\u043e\u043d\u0446\u0435 \u0441\u043c\u0435\u043d\u0438\u0442\u044c \u0437\u043d\u0430\u043a rem_sign &lt;= rem_sign_start; end else begin in_progress = next_in_progress; x &lt;= next_x; y &lt;= next_y; r1 &lt;= next_r1; r2 &lt;= next_r2; r3 &lt;= next_r3; end end end  `endif  \/\/\u0432\u044b\u0434\u0430\u0451\u043c \u043d\u0430\u0440\u0443\u0436\u0443 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 assign rd_alu = is_op_muldiv ? rd_mul : rd_alu1;  endmodule <\/code><\/pre>\n<p> <\/div>\n<\/p><\/div>\n<p> \u041a\u043e\u0434 \u043d\u0430\u043f\u0438\u0441\u0430\u043d, \u043f\u043e\u0448\u043b\u0438 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c, \u043a \u0447\u0435\u043c\u0443 \u043f\u0440\u0438\u0432\u0435\u043b\u0438 \u043d\u0430\u0448\u0438 \u0441\u0442\u0430\u0440\u0430\u043d\u0438\u044f, \u0434\u043b\u044f \u044d\u0442\u043e\u0433\u043e \u0434\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043d\u043e\u0432\u044b\u0439 \u0444\u0430\u0439\u043b \u0432 \u0441\u0442\u0440\u043e\u043a\u0443 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438. <\/p>\n<pre><code class=\"bash\">iverilog.exe -I ..\/core -o tmp_sim core_tb.v ..\/core\/core.v ..\/core\/fast_div.v <\/code><\/pre>\n<p> \u0418 \u0442\u0430\u043a, \u0434\u043e \u043f\u043e\u044f\u0432\u043b\u0435\u043d\u0438\u044f \u043c\u043e\u0434\u0443\u043b\u044f \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442 CoreMark \u0440\u0430\u0431\u043e\u0442\u0430\u043b 77 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u0432, \u0442\u043e \u0435\u0441\u0442\u044c \u0432\u044b\u0434\u0430\u0432\u0430\u043b 1.3 CM\/\u041c\u0413\u0446. \u0417\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c \u0441 \u043c\u043d\u043e\u0433\u043e\u0442\u0430\u043a\u0442\u043e\u0432\u044b\u043c \u0431\u043b\u043e\u043a\u043e\u043c \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u044f.<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/ij\/r-\/hc\/ijr-hc70tukm0qroewl1hypuzqm.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/ij\/r-\/hc\/ijr-hc70tukm0qroewl1hypuzqm.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/ij\/r-\/hc\/ijr-hc70tukm0qroewl1hypuzqm.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/yz\/bk\/a0\/yzbka0srmu_8y9-mnqpogzimfqm.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/yz\/bk\/a0\/yzbka0srmu_8y9-mnqpogzimfqm.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/yz\/bk\/a0\/yzbka0srmu_8y9-mnqpogzimfqm.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> 37 \u043f\u0435\u0440\u0438\u043e\u0434\u043e\u0432, 2.7 CM\/Mhz, \u0434\u0430 \u044d\u0442\u043e \u0436\u0435 \u043d\u0430 \u0443\u0440\u043e\u0432\u043d\u0435 \u0441\u043e\u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u043c\u0438\u043a\u0440\u043e\u043a\u043e\u043d\u0442\u0440\u043e\u043b\u043b\u0435\u0440\u043e\u0432. \u0414\u0435\u043b\u0435\u043d\u0438\u0435 3 \u0431\u0430\u0439\u0442\u0430 \u043d\u0430 1 \u0431\u0430\u0439\u0442 \u0437\u0430\u043d\u044f\u043b\u043e 17 \u0442\u0430\u043a\u0442\u043e\u0432. \u0412\u0440\u043e\u0434\u0435 \u0431\u044b \u043c\u0435\u0434\u043b\u0435\u043d\u043d\u043e, \u043d\u043e \u043f\u043e \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u044e \u0441 \u043f\u0440\u043e\u0433\u0440\u0430\u043c\u043c\u043d\u044b\u043c \u0434\u0435\u043b\u0435\u043d\u0438\u0435\u043c \u043e\u0449\u0443\u0442\u0438\u043c\u043e \u0431\u044b\u0441\u0442\u0440\u0435\u0435. \u0422\u0435\u043f\u0435\u0440\u044c \u043f\u0435\u0440\u0435\u043a\u043b\u044e\u0447\u0430\u0435\u043c \u043d\u0430 \u043e\u0434\u043d\u043e\u0442\u0430\u043a\u0442\u043d\u044b\u0439 \u0431\u043b\u043e\u043a.<\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/vh\/ff\/ut\/vhffutvrauxovhjhxcv9jaorm6e.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/vh\/ff\/ut\/vhffutvrauxovhjhxcv9jaorm6e.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/vh\/ff\/ut\/vhffutvrauxovhjhxcv9jaorm6e.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> <img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/zp\/gp\/iz\/zpgpizxehwthttf9hk9mmewyyiq.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/zp\/gp\/iz\/zpgpizxehwthttf9hk9mmewyyiq.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/zp\/gp\/iz\/zpgpizxehwthttf9hk9mmewyyiq.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> 31 \u043f\u0435\u0440\u0438\u043e\u0434, 3.2 CM\/Mhz. \u041f\u0440\u0438\u0440\u043e\u0441\u0442 \u0443\u0436\u0435 \u043d\u0435 \u0442\u0430\u043a\u043e\u0439 \u0431\u043e\u043b\u044c\u0448\u043e\u0439, \u0442\u0430\u043a \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u0434\u0435\u043b\u0430\u0442\u044c ASIC, \u043e\u0434\u043d\u043e\u0442\u0430\u043a\u0442\u043d\u043e\u0435 \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u0435 \u043d\u0435 \u0442\u0430\u043a \u0443\u0436 \u0438 \u043d\u0443\u0436\u043d\u043e, \u0430 \u0434\u043b\u044f \u0432\u044b\u0447\u0438\u0441\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0437\u0430\u0434\u0430\u0447 \u043c\u043e\u0436\u043d\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u0438\u0441\u043f\u043e\u0441\u043e\u0431\u043b\u0435\u043d\u043d\u043e\u0435 \u043a \u043f\u043e\u0442\u043e\u0447\u043d\u044b\u043c \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f\u043c. \u0415\u0449\u0451 \u0432\u0430\u0436\u043d\u044b\u0439 \u043f\u0443\u043d\u043a\u0442, \u0434\u0435\u043b\u0435\u043d\u0438\u044f \u043f\u043e\u0447\u0442\u0438 \u043d\u0435 \u0432\u044b\u0437\u044b\u0432\u0430\u044e\u0442\u0441\u044f \u0432\u043e \u0432\u0440\u0435\u043c\u044f \u0442\u0435\u0441\u0442\u0430, \u0442\u0430\u043a \u0447\u0442\u043e \u0432\u043b\u0438\u044f\u043d\u0438\u0435 \u043d\u043e\u0432\u043e\u0433\u043e \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c\u0430 \u043b\u0443\u0447\u0448\u0435 \u043f\u0440\u043e\u0432\u0435\u0440\u044f\u0442\u044c \u043d\u0430 \u0447\u0451\u043c-\u0442\u043e \u0434\u0440\u0443\u0433\u043e\u043c.<\/p>\n<p> \u0418 \u0435\u0449\u0451 \u043e\u0434\u0438\u043d \u0432\u043e\u043f\u0440\u043e\u0441 \u2014 \u044d\u0442\u043e \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u044f \u043d\u0430 \u041f\u041b\u0418\u0421. \u041c\u043d\u043e\u0433\u043e\u0442\u0430\u043a\u0442\u043e\u0432\u044b\u0439 \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u043d\u0435 \u0441\u043d\u0438\u0437\u0438\u043b \u0441\u043a\u043e\u0440\u043e\u0441\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u044b \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430 \u2014 \u043a\u0430\u043a \u0431\u044b\u043b\u043e 50 \u041c\u0413\u0446 \u043d\u0430 EP4CE6, \u0442\u0430\u043a \u0438 \u043e\u0441\u0442\u0430\u043b\u043e\u0441\u044c \u2014 \u0438 \u0437\u0430\u043d\u044f\u043b \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e 700 LE. \u0410 \u043e\u0434\u043d\u043e\u0442\u0430\u043a\u0442\u043d\u043e\u0435 \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0443\u043c\u0435\u043d\u044c\u0448\u0430\u0435\u0442 \u0442\u0430\u043a\u0442\u043e\u0432\u0443\u044e \u0447\u0430\u0441\u0442\u043e\u0442\u0443 \u0434\u043e 5 \u041c\u0413\u0446, \u0437\u0430\u043d\u0438\u043c\u0430\u044f 7000 LE, \u0438 \u0434\u0430\u0436\u0435 \u0435\u0441\u043b\u0438 \u0443\u043c\u0435\u043d\u044c\u0448\u0438\u0442\u044c \u0447\u0438\u0441\u043b\u043e \u043f\u0440\u043e\u0439\u0434\u0435\u043d\u043d\u044b\u0445 \u0431\u0438\u0442 \u0434\u043e 1, \u0432\u044b\u0445\u043e\u0434\u0438\u0442 20 \u041c\u0413\u0446, \u0433\u0434\u0435-\u0442\u043e \u043d\u0430 \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0438 start_y \u0437\u0430\u043f\u0430\u0441 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0438\u0441\u044f\u043a\u0430\u0435\u0442. \u0412 \u043e\u0431\u0449\u0435\u043c, \u0431\u0435\u0437 \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0439 \u0440\u0435\u0430\u043b\u0438\u0437\u0430\u0446\u0438\u0438 \u0442\u0443\u0442 \u043d\u0438\u043a\u0430\u043a.<\/p><\/div>\n<\/div>\n<\/div>\n<p><!----><!----><\/div>\n<p><!----><!----><br \/> \u0441\u0441\u044b\u043b\u043a\u0430 \u043d\u0430 \u043e\u0440\u0438\u0433\u0438\u043d\u0430\u043b \u0441\u0442\u0430\u0442\u044c\u0438 <a href=\"https:\/\/habr.com\/ru\/articles\/922858\/\"> https:\/\/habr.com\/ru\/articles\/922858\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<div><!--[--><!--]--><\/div>\n<div id=\"post-content-body\">\n<div>\n<div class=\"article-formatted-body article-formatted-body article-formatted-body_version-1\">\n<div xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\"><img decoding=\"async\" src=\"https:\/\/habrastorage.org\/r\/w1560\/webt\/nw\/qv\/w6\/nwqvw6oq0dhgsnufm0kfiequi5s.png\" sizes=\"(max-width: 780px) 100vw, 50vw\" srcset=\"https:\/\/habrastorage.org\/r\/w780\/webt\/nw\/qv\/w6\/nwqvw6oq0dhgsnufm0kfiequi5s.png 780w,&#10;       https:\/\/habrastorage.org\/r\/w1560\/webt\/nw\/qv\/w6\/nwqvw6oq0dhgsnufm0kfiequi5s.png 781w\" loading=\"lazy\" decode=\"async\"\/><\/p>\n<p> \u0412 \u043f\u0440\u043e\u0448\u043b\u043e\u0439 \u0447\u0430\u0441\u0442\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u0435 \u043f\u0440\u043e\u0438\u0437\u0432\u043e\u0434\u0438\u0442\u0435\u043b\u044c\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u043d\u0430\u0448\u0435\u0433\u043e \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u043e\u0440\u0430, \u0442\u0435\u043f\u0435\u0440\u044c \u0431\u0443\u0434\u0435\u043c \u0435\u0433\u043e \u0443\u0441\u043a\u043e\u0440\u044f\u0442\u044c \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043c\u043e\u0434\u0443\u043b\u044f \u0430\u043f\u043f\u0430\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u0443\u043c\u043d\u043e\u0436\u0435\u043d\u0438\u044f \u0438 \u0434\u0435\u043b\u0435\u043d\u0438\u044f. \u041d\u0435 \u0445\u043e\u0442\u0435\u043b\u043e\u0441\u044c \u043f\u043e\u0432\u044b\u0448\u0430\u0442\u044c \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u043e\u043d\u043d\u0443\u044e \u044d\u043d\u0442\u0440\u043e\u043f\u0438\u044e, \u0432\u044b\u043a\u043b\u0430\u0434\u044b\u0432\u0430\u044f \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u0443\u044e \u0441\u0442\u0430\u0442\u044c\u044e \u043f\u0440\u043e \u0434\u0435\u043b\u0435\u043d\u0438\u0435 \u0441\u0442\u043e\u043b\u0431\u0438\u043a\u043e\u043c, \u043f\u043e\u044d\u0442\u043e\u043c\u0443 \u0432 \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u0435 \u0434\u0432\u0443\u0445 \u043d\u0435\u0434\u0435\u043b\u044c \u0438\u0441\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u043d\u0438\u0439 \u0443\u0434\u0430\u043b\u043e\u0441\u044c \u0441\u043e\u0431\u0440\u0430\u0442\u044c \u043d\u0435\u0447\u0442\u043e \u043a\u0440\u0430\u0441\u0438\u0432\u043e\u0435 \u0438 \u043f\u043e\u0442\u0435\u043d\u0446\u0438\u0430\u043b\u044c\u043d\u043e \u043e\u0447\u0435\u043d\u044c \u0431\u044b\u0441\u0442\u0440\u043e\u0435. \u041f\u0440\u0435\u0434\u044b\u0441\u0442\u043e\u0440\u0438\u044f \u0432 \u0441\u0442\u0430\u0442\u044c\u0435 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0441\u043b\u043e\u0436\u043d\u043e\u0439, \u043d\u043e \u0441\u0430\u043c \u0430\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u043f\u0440\u043e\u0441\u0442. <\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[],"tags":[],"class_list":["post-464957","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/464957","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=464957"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/464957\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=464957"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=464957"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=464957"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}