{"id":316503,"date":"2021-01-17T21:00:58","date_gmt":"2021-01-17T21:00:58","guid":{"rendered":"http:\/\/savepearlharbor.com\/?p=316503"},"modified":"-0001-11-30T00:00:00","modified_gmt":"-0001-11-29T21:00:00","slug":"","status":"publish","type":"post","link":"https:\/\/savepearlharbor.com\/?p=316503","title":{"rendered":"\u041f\u0440\u043e\u043a\u0430\u0447\u0438\u0432\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 HDL \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python \u0438 PyTest"},"content":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/361\/3de\/491\/3613de491b55043f0dd335dd99b288c3.jpg\" width=\"600\" height=\"660\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e. \u041d\u0443 \u043b\u0430\u0434\u043d\u043e, \u043d\u0435 \u0432\u0441\u0435, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e. \u041f\u0438\u0448\u0443\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043d\u0430 Verilog, SystemVerilog \u0438 VHDL. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0430\u043a\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u0430 \u0434\u043b\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 Bash\/Makefile\/Tcl. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c GUI \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430 \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0430\u0447\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043d\u0430 Python, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u0430\u0436\u0435 \u043e\u0431\u0438\u0434\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044f \u0441\u0442\u0440\u0430\u0434\u0430\u043b \u0440\u0430\u043d\u0435\u0435 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0433\u043e bash-\u043a\u043e\u0434\u0430 \u0440\u043e\u0434\u0438\u043b.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043d\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u0442\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c. \u0423\u0436\u0435 \u0434\u0430\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0446\u0435\u043b\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <a href=\"https:\/\/vunit.github.io\/\" rel=\"noopener noreferrer nofollow\">VUnit<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0438 \u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0442\u0430\u0445, \u0442\u0430\u043a\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0447\u0430\u0441\u0442\u043e. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u044e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441\u0430\u043c\u0438\u0445 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439, \u0441 \u0447\u0435\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0431\u0435\u0437 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b. \u041d\u0443 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u043a\u0443\u0434\u0430 \u0436 \u0431\u0435\u0437 \u0442\u0430\u043a\u0438\u0445 \u0432\u0435\u0449\u0435\u0439 \u043a\u0430\u043a &#171;\u0443 \u043d\u0430\u0441 \u0442\u0430\u043a \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e&#187; \u0438 &#171;not invented here&#187;.<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043e \u0437\u0430\u043c\u0435\u043d\u0435 \u043e\u0434\u043d\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435, \u0431\u043e\u043b\u0435\u0435 \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u044b\u0435 \u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435. \u0411\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u043a\u043e\u0434\u0443, \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430\u043c \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0438\u0445 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 HDL \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c:<\/p>\n<ul>\n<li>\n<p>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b, \u0432\u043d\u0435\u0441\u0442\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0432\u044b, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0435\u0437 GUI. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0431\u0435\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c, \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e \u0432\u044b\u0432\u043e\u0434\u0443 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 GUI \u0438\u043b\u0438 \u0431\u0435\u0437, \u043d\u043e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (\u0434\u0435\u0444\u0430\u0439\u043d\u0430\u043c\u0438), \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u0441 \u043f\u0440\u0435-\/\u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435. \u0418\u043b\u0438 \u0441\u0430\u043c \u0442\u0435\u0441\u0442 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u0432\u043d\u0435 HDL.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u041f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u041f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0432\u0441\u0435\u0445 \u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0448\u0438\u043d\u044b, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 \u0442.\u0434).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0438. \u0422\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043b\u0435\u0433\u043a\u043e \u0438\u0434\u0442\u0438 \u043c\u0438\u043d\u0443\u0442\u044b\/\u0447\u0430\u0441\u044b \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0421\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 CI. \u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0447\u0435\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0435\u0439 CI (\u043f\u0440\u043e\u0433\u043e\u043d \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430, &#171;\u043d\u043e\u0447\u043d\u044b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438&#187; \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0443 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0437\u0430 \u0440\u0430\u0437 &#8212; \u043d\u0443\u0436\u0435\u043d \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0436\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0448\u0435\u043b, \u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0442 \u0438 \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435.<\/p>\n<h3>\u0418\u0434\u0435\u044f<\/h3>\n<p>\u0412\u0441\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432:<\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0438\u043c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043f\u043e \u044f\u0437\u044b\u043a\u0443);<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 (\u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f include);<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0434\u0435\u0444\u0430\u0439\u043d\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0438\u043c\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u0443\u0434\u0430 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445);<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0438\u043c\u044f \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f (\u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u0438\u043c\u044f \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430);<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u044e\u0447\u0435\u0439, \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 Python, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b \u0432 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 <code>Simulator<\/code>, \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>run()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430? \u0412 \u0446\u0435\u043b\u043e\u043c, \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u044f \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f Icarus Verilog, Modelsim \u0438 Vivado Simulator, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u043e\u0434\u0443\u043b\u044c <code>subprocess<\/code>\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c. \u0422\u0430\u043a\u0436\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043a\u043b\u0430\u0441\u0441 <code>CliArgs<\/code>, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0435 <code>argparse<\/code>, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u041d\u0443 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/esynr3z\/pyhdlsim\/blob\/master\/sim\/sim.py\" rel=\"noopener noreferrer nofollow\">sim.py<\/a>.<\/p>\n<p>\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0441\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0451 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u044f\u0434\u043e\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Python, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0438\u0437 <code>sim.py<\/code> \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<h3>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<\/h3>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0432\u044b\u0442\u044f\u043d\u0443\u043b \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u0431\u044b\u043b \u0445\u043e\u0442\u044c \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u0430. \u041a\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/www.researchgate.net\/publication\/2532597_An_FPGA_Implementation_of_a_Fixed-Point_Square_Root_Operation\" rel=\"noopener noreferrer nofollow\">An FPGA Implementation of a Fixed-Point Square Root Operation<\/a>.<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/219\/5cb\/c7b\/2195cbc7be6b01cb59de9e42c299cf8c.png\" width=\"996\" height=\"645\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/github.com\/esynr3z\/pyhdlsim\" rel=\"noopener noreferrer nofollow\">pyhdlsim \u043d\u0430 GitHub<\/a>.<\/p>\n<p>\u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u0430:<\/p>\n<pre><code>$ tree -a -I .git . \u251c\u2500\u2500 .github \u2502   \u2514\u2500\u2500 workflows # Github Actions \u2502       \u251c\u2500\u2500 icarus-test.yml # \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 Icarus Verilog \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430 \u043d\u0430 github \u2502       \u2514\u2500\u2500 modelsim-test.yml # \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 Modelsim \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430 \u043d\u0430 github \u251c\u2500\u2500 .gitignore \u251c\u2500\u2500 LICENSE.txt \u251c\u2500\u2500 README.md \u251c\u2500\u2500 sim # \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u2502   \u251c\u2500\u2500 conftest.py \u2502   \u251c\u2500\u2500 sim.py \u2502   \u2514\u2500\u2500 test_sqrt.py \u2514\u2500\u2500 src # \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438     \u251c\u2500\u2500 beh # \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u0438\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u043c\u043e\u0434\u0435\u043b\u0438     \u2502   \u2514\u2500\u2500 sqrt.py     \u251c\u2500\u2500 rtl # \u0441\u0438\u043d\u0442\u0435\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0439 HDL \u043a\u043e\u0434     \u2502   \u2514\u2500\u2500 sqrt.v     \u2514\u2500\u2500 tb # HDL \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439         \u2514\u2500\u2500 tb_sqrt.sv <\/code><\/pre>\n<p>\u0421\u0430\u043c \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447 <code>tb_sqrt.sv<\/code> \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0435\u043d: \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f &#171;\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>$sqrt()<\/code>, \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u043e\u0440\u043d\u044f, \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0430\u043c\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u044f\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e, \u0434\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (\u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e \u0432\u0435\u0441\u044c HDL \u0438 \u0444\u0430\u0439\u043b <code>sim.py<\/code> \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b). \u0412\u0441\u0451 \u0434\u0435\u0439\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043f\u043a\u0438 <code>sim<\/code>. \u041e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u0431\u0443\u043a\u0432 \u043c\u043d\u043e\u0433\u043e \u0432\u043f\u0435\u0440\u0435\u0434\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442.<\/p>\n<h3>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <code>test_sqrt.py<\/code> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  from sim import Simulator  sim = Simulator(name='icarus', gui=True, cwd='work') sim.incdirs += [\"..\/src\/tb\", \"..\/src\/rtl\", sim.cwd] sim.sources += [\"..\/src\/rtl\/sqrt.v\", \"..\/src\/tb\/tb_sqrt.sv\"] sim.top = \"tb_sqrt\" sim.setup() sim.run()<\/code><\/pre>\n<p>\u0422\u0435\u0441\u0442 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0432 Icarus \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c GTKWave \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c. \u041f\u0443\u0442\u0438 \u0434\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0417\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043d\u043a\u043b\u0443\u0434\u043e\u0432 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438 &#8212; \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>sim.setup()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u0430\u043f\u043a\u0430 <code>work<\/code> (\u0430 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430, \u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0437\u0430\u043d\u043e\u0432\u043e) \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d (<code>sim.run()<\/code>).<\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<pre><code>chmod +x test_sqrt.py .\/test_sqrt.py<\/code><\/pre>\n<p>\u0421\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0439\u0442\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u043a\u043d\u043e GTKWave.<\/p>\n<h3>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0435\u0437 GUI<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0431\u0435\u0437 \u043a\u043e\u043d\u0446\u0430 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442, \u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0441\u0435\u0440 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <code>CliArgs<\/code>. \u0422\u0435\u0441\u0442 \u0432\u044b\u043d\u0435\u0441 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0430\u0440\u0441\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0430\u043c \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  from sim import Simulator, CliArgs  def test(tmpdir, defines, simtool, gui):     sim = Simulator(name=simtool, gui=gui, cwd=tmpdir)     sim.incdirs += [\"..\/src\/tb\", \"..\/src\/rtl\", sim.cwd]     sim.sources += [\"..\/src\/rtl\/sqrt.v\", \"..\/src\/tb\/tb_sqrt.sv\"]     sim.defines += defines     sim.top = \"tb_sqrt\"     sim.setup()     sim.run()  if __name__ == '__main__':     # run script with key -h to see help     args = CliArgs(default_test=\"test\").parse()     test(tmpdir='work', simtool=args.simtool, gui=args.gui, defines=args.defines)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e:<\/p>\n<pre><code class=\"bash\">$ .\/test_sqrt.py -h usage: test_sqrt.py [-h] [-t &lt;name&gt;] [-s &lt;name&gt;] [-b] [-d &lt;def&gt; [&lt;def&gt; ...]]  optional arguments:   -h, --help            show this help message and exit   -t &lt;name&gt;             test &lt;name&gt;; default is 'test'   -s &lt;name&gt;             simulation tool &lt;name&gt;; default is 'icarus'   -b                    enable batch mode (no GUI)   -d &lt;def&gt; [&lt;def&gt; ...]  define &lt;name&gt;; option can be used multiple times<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435:<\/p>\n<pre><code class=\"bash\">$ .\/test_sqrt.py -b Run Icarus (cwd=\/space\/projects\/pyhdlsim\/simtmp\/work) TOP_NAME=tb_sqrt SIM iverilog -I \/space\/projects\/pyhdlsim\/src\/tb -I \/space\/projects\/pyhdlsim\/src\/rtl -I \/space\/projects\/pyhdlsim\/simtmp\/work -D TOP_NAME=tb_sqrt -D SIM -g2005-sv -s tb_sqrt -o worklib.vvp \/space\/projects\/pyhdlsim\/src\/rtl\/sqrt.v \/space\/projects\/pyhdlsim\/src\/tb\/tb_sqrt.sv  vvp worklib.vvp -lxt2 LXT2 info: dumpfile dump.vcd opened for output. Test started. Will push 8 words to DUT. !@# TEST PASSED #@!<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435:<\/p>\n<pre><code class=\"bash\"># \u043a\u0430\u043a \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 .\/test_sqrt.py -s modelsim -b # \u0442\u0430\u043a \u0438 \u0441 GUI .\/test_sqrt.py -s modelsim<\/code><\/pre>\n<h3>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0444\u0430\u0439\u043d\u044b \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"bash\">$ .\/test_sqrt.py -b -d ITER_N=42 Run Icarus (cwd=\/space\/projects\/pyhdlsim\/simtmp\/work) TOP_NAME=tb_sqrt SIM iverilog -I \/space\/projects\/pyhdlsim\/src\/tb -I \/space\/projects\/pyhdlsim\/src\/rtl -I \/space\/projects\/pyhdlsim\/simtmp\/work -D TOP_NAME=tb_sqrt -D SIM -g2005-sv -s tb_sqrt -o worklib.vvp \/space\/projects\/pyhdlsim\/src\/rtl\/sqrt.v \/space\/projects\/pyhdlsim\/src\/tb\/tb_sqrt.sv  vvp worklib.vvp -lxt2 LXT2 info: dumpfile dump.vcd opened for output. Test started. Will push 42 words to DUT. !@# TEST PASSED #@!<\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u0441 \u043f\u0440\u0435-\/\u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u043e\u043c<\/h3>\n<p>\u0427\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430 \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0442\u0435\u0441\u0442, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430 Verilog \u0441 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 Python. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0436\u0435 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432\u044b\u0448\u0435 &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u043d\u0430 Python, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e \u043e\u043d \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u0439\u043b <code>src\/beh\/sqrt.py<\/code>. \u041e\u0442\u0442\u0443\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>nrsqrt()<\/code>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430, \u0432 <code>test_sv<\/code>. \u0418 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 <code>test_py<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>nrsqrt()<\/code>.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  from sim import Simulator, CliArgs, path_join, write_memfile import random import sys sys.path.append('..\/src\/beh') from sqrt import nrsqrt  def create_sim(cwd, simtool, gui, defines):     sim = Simulator(name=simtool, gui=gui, cwd=cwd)     sim.incdirs += [\"..\/src\/tb\", \"..\/src\/rtl\", cwd]     sim.sources += [\"..\/src\/rtl\/sqrt.v\", \"..\/src\/tb\/tb_sqrt.sv\"]     sim.defines += defines     sim.top = \"tb_sqrt\"     return sim  def test_sv(tmpdir, defines, simtool, gui):     sim = create_sim(tmpdir, simtool, gui, defines)     sim.setup()     sim.run()  def test_py(tmpdir, defines, simtool, gui=False, pytest_run=True):     # prepare simulator     sim = create_sim(tmpdir, simtool, gui, defines)     sim.setup()     # prepare model data     try:         din_width = int(sim.get_define('DIN_W'))     except TypeError:         din_width = 32     iterations = 100     stimuli = [random.randrange(2 ** din_width) for _ in range(iterations)]     golden = [nrsqrt(d, din_width) for d in stimuli]     write_memfile(path_join(tmpdir, 'stimuli.mem'), stimuli)     write_memfile(path_join(tmpdir, 'golden.mem'), golden)     sim.defines += ['ITER_N=%d' % iterations]     sim.defines += ['PYMODEL', 'PYMODEL_STIMULI=\"stimuli.mem\"', 'PYMODEL_GOLDEN=\"golden.mem\"']     # run simulation     sim.run()  if __name__ == '__main__':     args = CliArgs(default_test=\"test_sv\").parse()     try:         globals()[args.test](tmpdir='work', simtool=args.simtool, gui=args.gui, defines=args.defines)     except KeyError:         print(\"There is no test with name '%s'!\" % args.test)<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c, \u043a\u043e\u0433\u0434\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e, \u043c\u043e\u0436\u043d\u043e \u0432\u043e\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c\u0441\u044f \u043a\u043b\u044e\u0447\u043e\u043c \u0432\u044b\u0431\u043e\u0440\u0430 \u0442\u0435\u0441\u0442\u0430:<\/p>\n<pre><code class=\"bash\"># \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0432\u043f\u0430\u0434\u0430\u0442\u044c \u0441 \u0438\u043c\u0435\u043d\u0435\u043c \u0444\u0443\u043d\u043a\u0446\u0438\u0438 .\/test_sqrt.py -t test_py<\/code><\/pre>\n<p>\u0410\u043d\u0430\u043b\u043e\u0433\u0438\u0447\u043d\u044b\u043c \u043e\u0431\u0440\u0430\u0437\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u0438 \u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433 \u0432\u043d\u0443\u0442\u0440\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0449\u0435\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430 \u043f\u0440\u0438 \u0436\u0435\u043b\u0430\u043d\u0438\u0438.<\/p>\n<h3>\u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0421\u0435\u0439\u0447\u0430\u0441 \u0443 \u043d\u0430\u0441 \u0443\u0436\u0435 \u0435\u0441\u0442\u044c 2 \u0442\u0435\u0441\u0442\u0430, \u0430 \u0432\u0435\u0434\u044c \u0437\u0430\u0432\u0442\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u0431\u044b\u0442\u044c \u0438 202, \u0430 \u0437\u043d\u0430\u0447\u0438\u0442 \u0443\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u043f\u0435\u0440\u0435\u0436\u0438\u0432\u0430\u0442\u044c \u043e \u0442\u043e\u043c, \u0447\u0442\u043e \u043d\u0443\u0436\u0435\u043d \u0441\u043f\u043e\u0441\u043e\u0431 \u043a\u0430\u043a \u0438\u0445 \u0432\u0441\u0435 \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0437\u0430 \u0440\u0430\u0437. \u0418 \u0432\u043e\u0442 \u0442\u0443\u0442 \u043d\u0430 \u0441\u0446\u0435\u043d\u0435 \u043f\u043e\u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f pytest.<\/p>\n<p>\u041d\u0430\u043d\u043e-\u043b\u0438\u043a\u0431\u0435\u0437 \u043f\u043e pytest.<\/p>\n<ul>\n<li>\n<p>\u041d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430, pytest \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u043e \u0438\u0449\u0451\u0442 \u0432\u0441\u0451 \u043d\u0430\u0447\u0438\u043d\u0430\u044e\u0449\u0435\u0435\u0441\u044f \u043d\u0430 test* \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u0442: \u043c\u043e\u0434\u0443\u043b\u0438, \u0444\u0443\u043d\u043a\u0446\u0438\u0438, \u043a\u043b\u0430\u0441\u0441\u044b, \u043c\u0435\u0442\u043e\u0434\u044b.<\/p>\n<\/li>\n<li>\n<p>\u0422\u0435\u0441\u0442 \u0441\u0447\u0438\u0442\u0430\u0435\u0442\u0441\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043d\u044b\u043c, \u0435\u0441\u043b\u0438 \u043d\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u043b\u043e \u0438\u0441\u043a\u043b\u044e\u0447\u0435\u043d\u0438\u0439 (\u0442\u0438\u043f\u0438\u0447\u043d\u044b\u043c \u044f\u0432\u043b\u044f\u0435\u0442\u0441\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u0438\u0435 <code>assert<\/code> \u0434\u043b\u044f \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f).<\/p>\n<\/li>\n<li>\n<p>\u0414\u043b\u044f \u0444\u043e\u0440\u043c\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b (fixtures). \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0447\u0442\u043e \u043f\u043e\u0434\u0441\u0442\u0430\u0432\u043b\u044f\u0442\u044c \u0432 \u0442\u0435\u0441\u0442 <code>test_a(a)<\/code> \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u043a\u0430\u043a \u0440\u0430\u0437 \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u044f\u0435\u0442\u0441\u044f \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u043e\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u043e\u0436\u043d\u043e \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0444\u0430\u0439\u043b <code>conftest.py<\/code>, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u0440\u0430\u0437\u043c\u0435\u0441\u0442\u0438\u0442\u044c \u043a\u043e\u0434 \u0434\u043b\u044f \u0431\u043e\u043b\u0435\u0435 \u0442\u043e\u043d\u043a\u043e\u0433\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u044f \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432 \u0438 \u0438\u0445 \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f.<\/p>\n<\/li>\n<\/ul>\n<p>\u0422\u0438\u043f\u0438\u0447\u043d\u044b\u0435 \u0441\u0446\u0435\u043d\u0430\u0440\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430:<\/p>\n<ul>\n<li>\n<p><code>pytest<\/code> &#8212; \u0440\u0435\u043a\u0443\u0440\u0441\u0438\u0432\u043d\u044b\u0439 \u043f\u043e\u0438\u0441\u043a \u0438 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u043d\u0430\u0447\u0438\u043d\u0430\u044f \u0441 \u0442\u0435\u043a\u0443\u0449\u0435\u0439 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438;<\/p>\n<\/li>\n<li>\n<p><code>pytest -v<\/code> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0431\u043e\u043b\u0435e \u043f\u043e\u0434\u0440\u043e\u0431\u043d\u0443\u044e \u0438\u043d\u0444\u043e\u0440\u043c\u0430\u0446\u0438\u044e \u043e \u0445\u043e\u0434\u0435 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p><code>pytest -rP<\/code> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u044b\u0432\u043e\u0434 \u0432 stdout \u0442\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432, \u0447\u0442\u043e \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0438\u0441\u044c \u0443\u0441\u043f\u0435\u0448\u043d\u043e;<\/p>\n<\/li>\n<li>\n<p><code>pytest test_sqrt.py::test_sv<\/code> &#8212; \u0432\u044b\u043f\u043e\u043b\u043d\u0438\u0442\u044c \u0443\u043a\u0430\u0437\u0430\u043d\u043d\u044b\u0439 \u0442\u0435\u0441\u0442.<\/p>\n<\/li>\n<\/ul>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e \u0447\u0442\u043e\u0431\u044b \u0430\u0434\u0430\u043f\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0442\u0435\u043a\u0443\u0449\u0438\u0439 \u0441\u043a\u0440\u0438\u043f\u0442 \u043f\u043e\u0434 pytest \u043d\u0443\u0436\u043d\u043e \u0441\u043e\u0432\u0441\u0435\u043c \u043d\u0435\u043c\u043d\u043e\u0433\u043e. \u0418\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u0443\u0435\u043c \u0441\u0430\u043c pytest. \u0414\u043e\u0431\u0430\u0432\u0438\u043c \u043f\u0430\u0440\u0443 \u0444\u0438\u043a\u0441\u0442\u0443\u0440 \u0434\u043b\u044f \u0442\u0430\u043a\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 \u0442\u0435\u0441\u0442\u0430 \u043a\u0430\u043a <code>simtool<\/code> \u0438 <code>defines<\/code>. \u0417\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u043c\u043e\u0435 \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0430\u043c\u0438 \u0431\u0443\u0434\u0435\u0442 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u043d\u043e \u0432 \u043a\u0430\u0447\u0435\u0441\u0442\u0432\u0435 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 \u0432\u043e \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u0430\u0445. \u0414\u0432\u0430 \u0434\u0440\u0443\u0433\u0438\u0445 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u0430 <code>gui<\/code> \u0438 <code>pytest_run<\/code> \u0441\u043d\u0430\u0431\u0436\u0430\u0435\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f\u043c\u0438 \u043f\u043e \u0443\u043c\u043e\u043b\u0447\u0430\u043d\u0438\u044e. \u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438 \u0438\u0445 \u0442\u043e\u0436\u0435 \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0430\u043c\u0438, \u043d\u043e \u0442.\u043a. \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 pytest \u043e\u043d\u0438 \u043d\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043d\u0438\u043a\u0430\u043a\u043e\u0435 \u0434\u0440\u0443\u0433\u043e\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435, \u0442\u043e \u0441\u0434\u0435\u043b\u0430\u043b \u0442\u0430\u043a.<\/p>\n<p>\u0414\u0430, \u043a\u0441\u0442\u0430\u0442\u0438, \u043f\u043e\u044f\u0432\u0438\u043b\u0441\u044f \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442 <code>pytest_run<\/code> \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0441\u043e\u043e\u0431\u0449\u0430\u0435\u0442 \u043e \u0442\u043e\u043c, \u0432\u044b\u043f\u043e\u043b\u043d\u044f\u0435\u0442\u0441\u044f \u043b\u0438 \u0441\u0435\u0439\u0447\u0430\u0441 pytest, \u0438\u043b\u0438 \u043f\u0440\u043e\u0441\u0442\u043e \u0442\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u043e \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<p>\u0421 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u043c <code>tmpdir<\/code>  \u044f \u0441\u0445\u0438\u0442\u0440\u0438\u043b &#8212; \u044d\u0442\u043e \u0438\u043c\u044f \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u043e\u0439 \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u044b, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u043f\u0443\u0442\u044c \u043a \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u043e\u0439 \u043f\u0430\u043f\u043a\u0435, \u0443\u043d\u0438\u043a\u0430\u043b\u044c\u043d\u043e\u0439 \u0434\u043b\u044f \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430. \u0422.\u0435. \u0441\u0430\u043c\u0438 \u0442\u0435\u0441\u0442\u044b \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u0441\u044f \u0433\u0434\u0435-\u0442\u043e \u0432\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044f\u0445 \u0438 \u043d\u0435 \u0437\u0430\u0441\u043e\u0440\u044f\u0442\u044c \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 <code>sim<\/code>.<\/p>\n<p>\u0418\u043c\u0435\u043d\u0430 \u0442\u0435\u0441\u0442\u043e\u0432 \u0442\u043e\u0436\u0435 \u0438\u0437\u043c\u0435\u043d\u044f\u0442\u044c \u043d\u0435 \u043d\u0443\u0436\u043d\u043e &#8212; \u043e\u043d\u0438 \u0431\u0443\u0434\u0443\u0442 \u043d\u0430\u0439\u0434\u0435\u043d\u044b pytest, \u0442.\u043a. \u0438\u043c\u0435\u044e\u0442 \u043f\u0440\u0435\u0444\u0438\u043a\u0441 test_.<\/p>\n<p>\u0420\u0435\u0448\u0435\u043d\u0438\u0435 \u043e \u0442\u043e\u043c, \u043f\u0440\u043e\u0448\u0435\u043b \u0442\u0435\u0441\u0442 \u0438\u043b\u0438 \u043d\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0435\u0442\u0441\u044f \u043f\u043e \u0441\u043e\u0441\u0442\u043e\u044f\u043d\u0438\u044e \u0430\u0442\u0442\u0440\u0438\u0431\u0443\u0442\u0430 <code>is_passed<\/code> \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430. \u041e\u043d \u0432\u043e\u0437\u0432\u0440\u0430\u0449\u0430\u0435\u0442 \u0438\u0441\u0442\u0438\u043d\u0443, \u0435\u0441\u043b\u0438 \u0443\u0432\u0438\u0434\u0435\u043b \u043a\u043b\u044e\u0447\u0435\u0432\u0443\u044e \u0444\u0440\u0430\u0437\u0443 <code>!@# TEST PASSED #@!<\/code> \u0432 stdout. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0435\u0441\u043b\u0438 \u043a\u043e\u043c\u043f\u0438\u043b\u044f\u0446\u0438\u044f \u0431\u044b\u043b\u0430 \u043d\u0435\u0443\u0434\u0430\u0447\u043d\u043e\u0439, \u0438\u043b\u0438 \u0442\u0435\u0441\u0442 \u0437\u0430\u0432\u0435\u0440\u0448\u0438\u043b\u0441\u044f \u0441 \u043e\u0448\u0438\u0431\u043a\u043e\u0439, \u0442\u043e \u044d\u0442\u043e\u0439 \u0444\u0440\u0430\u0437\u044b \u0432\u044b\u0432\u0435\u0434\u0435\u043d\u043e \u043d\u0435 \u0431\u0443\u0434\u0435\u0442. \u042d\u0442\u043e \u0441\u0430\u043c\u044b\u0439 \u043f\u0440\u043e\u0441\u0442\u043e\u0439 \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043d\u043e \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u0438 \u0434\u043b\u044f \u0435\u0433\u043e \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0434\u0435\u0441\u044c \u043e\u0433\u0440\u0430\u043d\u0438\u0447\u0435\u043d\u044b \u043b\u0438\u0448\u044c \u0444\u0430\u043d\u0442\u0430\u0437\u0438\u0435\u0439. \u041c\u043e\u0436\u043d\u043e \u043f\u043e\u043b\u0443\u0447\u0438\u0442\u044c stdout \u0447\u0435\u0440\u0435\u0437 <code>sim.stdout<\/code> \u0438 \u0438\u0441\u043a\u0430\u0442\u044c \u0442\u0430\u043c \u0447\u0442\u043e \u0443\u0433\u043e\u0434\u043d\u043e.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  import pytest from sim import Simulator, CliArgs, path_join, write_memfile import random import sys sys.path.append('..\/src\/beh') from sqrt import nrsqrt  @pytest.fixture() def defines():     return []  @pytest.fixture def simtool():     return 'icarus'  def create_sim(cwd, simtool, gui, defines):     sim = Simulator(name=simtool, gui=gui, cwd=cwd, passed_marker='!@# TEST PASSED #@!')     sim.incdirs += [\"..\/src\/tb\", \"..\/src\/rtl\", cwd]     sim.sources += [\"..\/src\/rtl\/sqrt.v\", \"..\/src\/tb\/tb_sqrt.sv\"]     sim.defines += defines     sim.top = \"tb_sqrt\"     return sim  def test_sv(tmpdir, defines, simtool, gui=False, pytest_run=True):     sim = create_sim(tmpdir, simtool, gui, defines)     sim.setup()     sim.run()     if pytest_run:         assert sim.is_passed  def test_py(tmpdir, defines, simtool, gui=False, pytest_run=True):     # prepare simulator     sim = create_sim(tmpdir, simtool, gui, defines)     sim.setup()     # prepare model data     try:         din_width = int(sim.get_define('DIN_W'))     except TypeError:         din_width = 32     iterations = 100     stimuli = [random.randrange(2 ** din_width) for _ in range(iterations)]     golden = [nrsqrt(d, din_width) for d in stimuli]     write_memfile(path_join(tmpdir, 'stimuli.mem'), stimuli)     write_memfile(path_join(tmpdir, 'golden.mem'), golden)     sim.defines += ['ITER_N=%d' % iterations]     sim.defines += ['PYMODEL', 'PYMODEL_STIMULI=\"stimuli.mem\"', 'PYMODEL_GOLDEN=\"golden.mem\"']     # run simulation     sim.run()     if pytest_run:         assert sim.is_passed  if __name__ == '__main__':     args = CliArgs(default_test=\"test_sv\").parse()     try:         globals()[args.test](tmpdir='work', simtool=args.simtool, gui=args.gui, defines=args.defines, pytest_run=False)     except KeyError:         print(\"There is no test with name '%s'!\" % args.test)<\/code><\/pre>\n<p>\u041f\u0440\u043e\u0433\u043e\u043d\u0438\u043c \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437:<\/p>\n<pre><code class=\"bash\">$ pytest ========== test session starts =========== platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 rootdir: \/space\/projects\/misc\/habr-publications\/pyhdlsim\/pyhdlsim\/simtmp plugins: xdist-2.2.0, forked-1.3.0 collected 2 items  test_sqrt.py ..                    [100%]  =========== 2 passed in 0.08s ============  $ pytest -v ========== test session starts =========== platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 -- \/usr\/bin\/python3 cachedir: .pytest_cache rootdir: \/space\/projects\/misc\/habr-publications\/pyhdlsim\/pyhdlsim\/simtmp plugins: xdist-2.2.0, forked-1.3.0 collected 2 items  test_sqrt.py::test_sv PASSED       [ 50%] test_sqrt.py::test_py PASSED       [100%]  =========== 2 passed in 0.08s ============<\/code><\/pre>\n<h3>\u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u041d\u0435\u043f\u043b\u043e\u0445\u043e \u0431\u044b\u043b\u043e \u0431\u044b \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0434\u043b\u044f \u0440\u0430\u0437\u043d\u043e\u0439 \u0432\u0435\u043b\u0438\u0447\u0438\u043d\u044b \u0448\u0438\u0440\u0438\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0445. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u0447\u0442\u043e \u0440\u0443\u043a\u0430\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b N \u0440\u0430\u0437, \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0430\u043d\u0430\u043b\u0438\u0437\u0438\u0440\u0443\u044f \u0433\u043b\u0430\u0437\u0430\u043c\u0438 \u043b\u043e\u0433\u0438 \u0432 \u043f\u043e\u0438\u0441\u043a\u0430\u0445 \u0444\u0440\u0430\u0437\u044b \u043e\u0431 \u0443\u0441\u043f\u0435\u0448\u043d\u043e\u043c \u0437\u0430\u0432\u0435\u0440\u0448\u0435\u043d\u0438\u0438, \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u0443\u0442\u043e\u043c\u0438\u0442\u0435\u043b\u044c\u043d\u043e. \u041d\u0443\u0436\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c pytest.<\/p>\n<p>\u041c\u043e\u0434\u0438\u0444\u0438\u043a\u0430\u0446\u0438\u044f \u0431\u0443\u0434\u0435\u0442 \u043c\u0438\u043d\u0438\u043c\u0430\u043b\u044c\u043d\u043e\u0439, \u043d\u0443\u0436\u043d\u043e \u043b\u0438\u0448\u044c \u043e\u0431\u043d\u043e\u0432\u0438\u0442\u044c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0443 <code>defines<\/code>:<\/p>\n<pre><code class=\"python\"># \u0437\u0430\u043c\u0435\u043d\u0438\u043c \u044d\u0442\u043e @pytest.fixture() def defines():     return [] # \u043d\u0430 \u044d\u0442\u043e @pytest.fixture(params=[[], ['DIN_W=16'], ['DIN_W=18'], ['DIN_W=25'], ['DIN_W=32']]) def defines(request):     return request.param<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0430 \u043c\u043e\u0436\u0435\u0442 \u043f\u0440\u0438\u043d\u0438\u043c\u0430\u0442\u044c \u043e\u0434\u043d\u043e \u0438\u0437 5 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u0442\u0435\u0441\u0442\u044b:<\/p>\n<pre><code class=\"bash\">$ pytest -v ================== test session starts ================== platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 -- \/usr\/bin\/python3 cachedir: .pytest_cache rootdir: \/space\/projects\/misc\/habr-publications\/pyhdlsim\/pyhdlsim\/simtmp plugins: xdist-2.2.0, forked-1.3.0 collected 10 items  test_sqrt.py::test_sv[defines0] PASSED            [ 10%] test_sqrt.py::test_sv[defines1] PASSED            [ 20%] test_sqrt.py::test_sv[defines2] PASSED            [ 30%] test_sqrt.py::test_sv[defines3] PASSED            [ 40%] test_sqrt.py::test_sv[defines4] PASSED            [ 50%] test_sqrt.py::test_py[defines0] PASSED            [ 60%] test_sqrt.py::test_py[defines1] PASSED            [ 70%] test_sqrt.py::test_py[defines2] PASSED            [ 80%] test_sqrt.py::test_py[defines3] PASSED            [ 90%] test_sqrt.py::test_py[defines4] PASSED            [100%]  ================== 10 passed in 0.28s ===================<\/code><\/pre>\n<p>\u041a\u0430\u043a \u0432\u0438\u0434\u0438\u043c, \u0442\u0435\u043f\u0435\u0440\u044c \u043a\u0430\u0436\u0434\u044b\u0439 \u0442\u0435\u0441\u0442 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u043b\u0441\u044f \u043f\u043e 5 \u0440\u0430\u0437 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0434\u0435\u0444\u0430\u0439\u043d\u043e\u043c.<\/p>\n<h3>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0438<\/h3>\n<p>\u0422\u0443\u0442 \u0442\u043e\u0436\u0435 \u0432\u0441\u0451 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0441\u0442\u043e \u0438 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442 \u043f\u043e\u0447\u0442\u0438 \u0438\u0437 \u043a\u043e\u0440\u043e\u0431\u043a\u0438. \u0421\u0442\u0430\u0432\u0438\u043c \u043e\u0434\u0438\u043d \u043f\u043b\u0430\u0433\u0438\u043d:<\/p>\n<pre><code class=\"bash\">python3 -m pip install pytest-xdist<\/code><\/pre>\n<p>\u0418 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u0442\u0435\u0441\u0442\u044b \u0432 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0445 \u043f\u043e\u0442\u043e\u043a\u043e\u0432, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0432 4:<\/p>\n<pre><code class=\"bash\"># \u043c\u043e\u0436\u043d\u043e \u0442\u0430\u043a\u0436\u0435 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u043e\u0432\u0430\u0442\u044c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435 auto, pytest \u0437\u0430\u0434\u0435\u0439\u0441\u0442\u0432\u0443\u0435\u0442 \u0432\u0441\u0435 \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u044b\u0435 \u044f\u0434\u0440\u0430 pytest -n 4<\/code><\/pre>\n<p>\u0414\u043b\u044f \u0442\u043e\u0433\u043e, \u0447\u0442\u043e\u0431\u044b \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u044d\u0442\u043e\u0433\u043e \u043c\u0435\u0445\u0430\u043d\u0438\u0437\u043c\u0430 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0434\u043b\u0438\u0442\u0435\u043b\u044c\u043d\u044b\u0439 \u0442\u0435\u0441\u0442:<\/p>\n<pre><code class=\"python\">def test_slow(tmpdir, defines, simtool, gui=False, pytest_run=True):     sim = create_sim(tmpdir, simtool, gui, defines)     sim.defines += ['ITER_N=500000']     sim.setup()     sim.run()     if pytest_run:         assert sim.is_passed<\/code><\/pre>\n<p>\u0417\u0430\u043f\u0443\u0441\u0442\u0438\u043c \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438 \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 (\u0442\u0435\u0441\u0442\u043e\u0432 \u0442\u0435\u043f\u0435\u0440\u044c \u0441\u0442\u0430\u043b\u043e 3*5=15):<\/p>\n<pre><code class=\"bash\">$ pytest =================== test session starts ==================== platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 rootdir: \/space\/projects\/misc\/habr-publications\/pyhdlsim\/pyhdlsim\/simtmp plugins: xdist-2.2.0, forked-1.3.0 collected 15 items  test_sqrt.py ...............                         [100%]  ============== 15 passed in 242.74s (0:04:02) ==============  $ pytest -n auto =================== test session starts ==================== platform linux -- Python 3.8.5, pytest-6.2.1, py-1.10.0, pluggy-0.13.1 rootdir: \/space\/projects\/misc\/habr-publications\/pyhdlsim\/pyhdlsim\/simtmp plugins: xdist-2.2.0, forked-1.3.0 gw0 [15] \/ gw1 [15] \/ gw2 [15] \/ gw3 [15] ...............                                      [100%] ============== 15 passed in 145.66s (0:02:25) ==============<\/code><\/pre>\n<p>\u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043a\u0430\u043a \u0433\u043e\u0432\u043e\u0440\u0438\u0442\u0441\u044f, \u0432\u0438\u0434\u043d\u043e \u043d\u0435\u0432\u043e\u043e\u0440\u0443\u0436\u0435\u043d\u043d\u044b\u043c \u0432\u0437\u0433\u043b\u044f\u0434\u043e\u043c.<\/p>\n<h3>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432<\/h3>\n<p>\u0420\u0430\u043d\u0435\u0435 \u0443\u0436\u0435 \u0431\u044b\u043b\u043e \u043f\u043e\u043a\u0430\u0437\u0430\u043d\u043e, \u0447\u0442\u043e \u043f\u0440\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0438 \u0442\u0435\u0441\u0442\u0430 \u0431\u0435\u0437 pytest \u043c\u043e\u0436\u043d\u043e \u0431\u044b\u043b\u043e \u0432\u044b\u0431\u0440\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u043a\u043b\u044e\u0447\u0430 <code>-s<\/code>. \u0422\u0435\u043f\u0435\u0440\u044c \u0436\u0435 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0432\u044b\u0431\u043e\u0440 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430 \u0434\u043b\u044f pytest. \u041e\u0447\u0435\u0432\u0438\u0434\u043d\u043e, \u043d\u0443\u0436\u043d\u043e \u0447\u0442\u043e-\u0442\u043e \u0441\u0434\u0435\u043b\u0430\u0442\u044c \u0441 \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u043e\u0439 <code>simtool<\/code>.<\/p>\n<p>\u0422\u0443\u0442 \u043d\u0430\u043c \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0437\u043d\u0430\u043d\u0438\u0435 \u043e \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043d\u0438\u0438 \u0444\u0430\u0439\u043b\u0430 <code>conftest.py<\/code>, \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0433\u043e \u0434\u043b\u044f \u043a\u0430\u0441\u0442\u043e\u043c\u0438\u0437\u0430\u0446\u0438\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u0432 pytest. \u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0442\u0430\u043a\u043e\u0439 \u0444\u0430\u0439\u043b \u0440\u044f\u0434\u043e\u043c \u0441 <code>sim.py<\/code> \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043c \u0442\u0443\u0434\u0430 \u0441\u043b\u0435\u0434\u0443\u044e\u0449\u0438\u0439 \u043a\u043e\u0434:<\/p>\n<pre><code class=\"python\">def pytest_addoption(parser):     parser.addoption(\"--sim\", action=\"store\", default=\"icarus\")<\/code><\/pre>\n<p>\u0412 \u0444\u0430\u0439\u043b\u0435 \u0442\u0435\u0441\u0442\u0430 <code>test_sqrt.py<\/code> \u043e\u0431\u043d\u043e\u0432\u0438\u043c \u0444\u0438\u043a\u0441\u0442\u0443\u0440\u0443 <code>simtool<\/code>:<\/p>\n<pre><code class=\"python\">@pytest.fixture def simtool(pytestconfig):     return pytestconfig.getoption(\"sim\")<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435:<\/p>\n<pre><code class=\"bash\">pytest --sim modelsim -n auto<\/code><\/pre>\n<h3>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 CI. Github Actions + (Modelsim | Icarus)<\/h3>\n<p>\u041d\u0443 \u0438 \u0431\u043e\u043d\u0443\u0441\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0447\u0430\u0441\u0442\u044c \u043e \u043d\u0435\u043f\u0440\u0435\u0440\u044b\u0432\u043d\u043e\u0439 \u0438\u043d\u0442\u0435\u0433\u0440\u0430\u0446\u0438\u0438 (CI). \u0412 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u0434\u043e\u0431\u0430\u0432\u043b\u0435\u043d\u044b \u0434\u0432\u0430 \u0444\u0430\u0439\u043b\u0430 <code>.github\/workflows\/icarus-test.yml<\/code> \u0438 <code>.github\/workflows\/modelsim-test.yml<\/code>. \u042d\u0442\u043e \u0442\u0430\u043a \u043d\u0430\u0437\u044b\u0432\u0430\u0435\u043c\u044b\u0435 Github Actions &#8212; \u043f\u043e \u043e\u043f\u0440\u0435\u0434\u0435\u043b\u0435\u043d\u043d\u043e\u043c\u0443 \u0441\u043e\u0431\u044b\u0442\u0438\u044e \u0431\u0443\u0434\u0435\u0442 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u043e \u0438\u0445 \u0441\u043e\u0434\u0435\u0440\u0436\u0438\u043c\u043e\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0432\u0438\u0440\u0442\u0443\u0430\u043b\u044c\u043d\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f, \u043f\u0440\u0435\u0434\u043e\u0441\u0442\u0430\u0432\u043b\u044f\u0435\u043c\u043e\u0433\u043e Github. \u0412 \u0434\u0430\u043d\u043d\u043e\u043c \u0441\u043b\u0443\u0447\u0430\u0435, \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430 \u0431\u0443\u0434\u0443\u0442 \u043f\u0440\u043e\u0433\u043d\u0430\u043d\u044b \u0432\u0441\u0435 \u0442\u0435\u0441\u0442\u044b \u0432 \u0434\u0432\u0443\u0445 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430\u0445.<\/p>\n<p>\u0412 Icarus Verilog:<\/p>\n<pre><code>- name: Install dependencies   run: |     python -m pip install --upgrade pip     pip install pytest pytest-xdist     sudo apt-get install iverilog - name: Test code   working-directory: .\/sim   run: |     pytest -n auto<\/code><\/pre>\n<p>\u0418 \u0432 Modelsim Intel Starter Pack:<\/p>\n<pre><code>- name: Install dependencies   run: |     python -m pip install --upgrade pip       pip install pytest pytest-xdist       sudo dpkg --add-architecture i386       sudo apt update       sudo apt install -y libc6:i386 libxtst6:i386 libncurses5:i386 libxft2:i386 libstdc++6:i386 libc6-dev-i386 lib32z1 libqt5xml5 liblzma-dev     wget https:\/\/download.altera.com\/akdlm\/software\/acdsinst\/20.1std\/711\/ib_installers\/ModelSimSetup-20.1.0.711-linux.run         chmod +x ModelSimSetup-20.1.0.711-linux.run     .\/ModelSimSetup-20.1.0.711-linux.run --mode unattended --accept_eula 1 --installdir $HOME\/ModelSim-20.1.0 --unattendedmodeui none     echo \"$HOME\/ModelSim-20.1.0\/modelsim_ase\/bin\" &gt;&gt; $GITHUB_PATH - name: Test code   working-directory: .\/sim   run: |     pytest -n auto --sim modelsim<\/code><\/pre>\n<p>\u0422\u0443\u0442 \u043a\u0441\u0442\u0430\u0442\u0438 \u043e\u0447\u0435\u043d\u044c \u043f\u043e\u0440\u0430\u0434\u043e\u0432\u0430\u043b\u0430 \u043f\u043e\u0441\u043b\u0435\u0434\u043d\u044f\u044f \u0432\u0435\u0440\u0441\u0438\u044f Modelsim. \u041e\u043d\u0438 \u043d\u0430\u043a\u043e\u043d\u0435\u0446-\u0442\u043e \u043f\u043e\u0447\u0438\u043d\u0438\u043b\u0438 \u0435\u0451! \u041a\u0430\u0436\u0434\u044b\u0439 \u043a\u0442\u043e \u0445\u043e\u0442\u044c \u0440\u0430\u0437 \u0443\u0441\u0442\u0430\u043d\u0430\u0432\u043b\u0438\u0432\u0430\u043b \u0435\u0433\u043e \u043d\u0430 Ubuntu\/Fedora \u043f\u043e\u0439\u043c\u0451\u0442 \u043e \u0447\u0451\u043c \u044f (\u0432\u043e\u0442, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0438\u043d\u0441\u0442\u0440\u0443\u043a\u0446\u0438\u044f \u0434\u043b\u044f <a href=\"https:\/\/gist.github.com\/esynr3z\/e25c12cd3fdf82e98da281e1f5831d87\" rel=\"noopener noreferrer nofollow\">Quartus+Modelsim 19.1 \u0438 Fedora 29<\/a>).<\/p>\n<p>\u041d\u0443 \u0438 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u0432\u0440\u0435\u043c\u0435\u043d\u0438 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u044f \u043f\u043e\u0441\u043b\u0435 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u043f\u0443\u0448\u0430 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439:<\/p>\n<figure class=\"full-width\"><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/habrastorage.org\/getpro\/habr\/upload_files\/df5\/9a9\/0a5\/df59a90a5bcc1ea3c0d5e8fa41e9a9e1.png\" width=\"1198\" height=\"537\"><figcaption><\/figcaption><\/figure>\n<p>\u0414\u0430\u0436\u0435 \u043d\u0435 \u0441\u043c\u043e\u0442\u0440\u044f \u043d\u0430 \u0442\u043e, \u0447\u0442\u043e \u0441\u043a\u0430\u0447\u0438\u0432\u0430\u043d\u0438\u0435 1.3GB \u0443\u0441\u0442\u0430\u043d\u043e\u0432\u043e\u0447\u043d\u0438\u043a\u0430 Modelsim \u0438 \u0435\u0433\u043e \u0440\u0430\u0441\u043f\u0430\u043a\u043e\u0432\u043a\u0430 \u0437\u0430\u043d\u0438\u043c\u0430\u044e\u0442 \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0432\u0440\u0435\u043c\u044f (\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u0442\u0435\u043c \u043d\u0435 \u043c\u0435\u043d\u0435\u0435, \u043e\u0447\u0435\u043d\u044c \u043c\u0430\u043b\u043e!), \u043e\u043d \u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u0432 \u0438\u0442\u043e\u0433\u0435 \u0435\u0449\u0451 \u0438 \u0431\u044b\u0441\u0442\u0440\u0435\u0435 \u043c\u043e\u043c\u0435\u043d\u0442\u0430\u043b\u044c\u043d\u043e \u0440\u0430\u0437\u0432\u0435\u0440\u0442\u044b\u0432\u0430\u0435\u043c\u043e\u0433\u043e Icarus.<\/p>\n<p>\u0422\u0443\u0442 \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u043c\u043e\u0436\u043d\u043e \u043f\u043e\u0439\u0442\u0438 \u0434\u0430\u043b\u044c\u0448\u0435 \u0438 \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c Docker-\u043e\u0431\u0440\u0430\u0437 \u0441 Modelsim, \u0447\u0442\u043e\u0431\u044b \u043d\u0435 \u043a\u0430\u0447\u0430\u0442\u044c \u0435\u0433\u043e \u043a\u0430\u0436\u0434\u044b\u0439 \u0440\u0430\u0437 \u0441\u0430\u0439\u0442\u0430, \u043d\u043e \u044f, \u043f\u043e\u0436\u0430\u043b\u0443\u0439, \u0437\u0434\u0435\u0441\u044c \u043e\u0441\u0442\u0430\u043d\u043e\u0432\u043b\u044e\u0441\u044c.<\/p>\n<p>\u0412 \u0446\u0435\u043b\u043e\u043c, \u043c\u043d\u0435 \u043f\u0440\u044f\u043c \u043e\u0447\u0435\u043d\u044c \u0437\u0430\u0448\u0451\u043b \u0441\u043f\u043e\u0441\u043e\u0431 \u043e\u0440\u0433\u0430\u043d\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0438 \u0442\u0435\u0441\u0442\u0438\u0440\u043e\u0432\u0430\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e Python, \u044d\u0442\u043e \u043a\u0430\u043a \u0433\u043b\u043e\u0442\u043e\u043a \u0441\u0432\u0435\u0436\u0435\u0433\u043e \u0432\u043e\u0437\u0434\u0443\u0445\u0430 \u043f\u043e\u0441\u043b\u0435 Bash, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u044f \u0447\u0430\u0449\u0435 \u0432\u0441\u0435\u0433\u043e \u043f\u0440\u0438\u043c\u0435\u043d\u044f\u043b \u0434\u043e \u044d\u0442\u043e\u0433\u043e. \u0418 \u043d\u0430\u0434\u0435\u044e\u0441\u044c, \u0447\u0442\u043e \u043a\u043e\u043c\u0443-\u043d\u0438\u0431\u0443\u0434\u044c \u043e\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u0438\u0442\u0441\u044f \u0442\u043e\u0436\u0435.<\/p>\n<p>\u0412\u0441\u0435 \u0444\u0438\u043d\u0430\u043b\u044c\u043d\u044b\u0435 \u0432\u0435\u0440\u0441\u0438\u0438 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u043b\u0435\u0436\u0430\u0442 \u0432 \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 <a href=\"https:\/\/github.com\/esynr3z\/pyhdlsim\" rel=\"noopener noreferrer nofollow\">pyhdlsim \u043d\u0430 GitHub<\/a>. <\/p>\n<\/div>\n<p> \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\/post\/537704\/\"> https:\/\/habr.com\/ru\/post\/537704\/<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"\n<div class=\"post__text post__text_v2\" id=\"post-content-body\">\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0412\u0441\u0435 \u0434\u0435\u043b\u0430\u044e\u0442 \u044d\u0442\u043e. \u041d\u0443 \u043b\u0430\u0434\u043d\u043e, \u043d\u0435 \u0432\u0441\u0435, \u043d\u043e \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e. \u041f\u0438\u0448\u0443\u0442 \u0441\u043a\u0440\u0438\u043f\u0442\u044b, \u0447\u0442\u043e\u0431\u044b \u0441\u0438\u043c\u0443\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0441\u0432\u043e\u0438 \u043f\u0440\u043e\u0435\u043a\u0442\u044b \u043d\u0430 Verilog, SystemVerilog \u0438 VHDL. \u041e\u0434\u043d\u0430\u043a\u043e, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u0442\u0430\u043a\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0447\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043d\u0435\u043f\u0440\u043e\u0441\u0442\u0430 \u0434\u043b\u044f \u0442\u0438\u043f\u0438\u0447\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u0435\u043c\u044b\u0445 Bash\/Makefile\/Tcl. \u041e\u0441\u043e\u0431\u0435\u043d\u043d\u043e, \u0435\u0441\u043b\u0438 \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e \u043d\u0435 \u0442\u043e\u043b\u044c\u043a\u043e \u043e\u0442\u043a\u0440\u044b\u0432\u0430\u0442\u044c GUI \u0434\u043b\u044f \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430 \u0438 \u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b, \u043d\u043e \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c \u043f\u0430\u0447\u043a\u0438 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0434\u043b\u044f \u0440\u0430\u0437\u043b\u0438\u0447\u043d\u044b\u0445 \u0431\u043b\u043e\u043a\u043e\u0432, \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442, \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0438\u0445 \u0432\u044b\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u0438 \u0442.\u0434. \u041e\u043a\u0430\u0437\u0430\u043b\u043e\u0441\u044c, \u0447\u0442\u043e \u0432\u0441\u0451 \u044d\u0442\u043e \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u044b\u0442\u044c \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u043e\u0437\u0440\u0430\u0447\u043d\u044b\u043c \u0438 \u043b\u0435\u0433\u043a\u043e \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u0438\u0432\u0430\u0435\u043c\u044b\u043c \u043a\u043e\u0434\u043e\u043c \u043d\u0430 Python, \u0447\u0442\u043e \u043c\u043d\u0435 \u0434\u0430\u0436\u0435 \u043e\u0431\u0438\u0434\u043d\u043e \u0441\u0442\u0430\u043d\u043e\u0432\u0438\u0442\u0441\u044f \u043e\u0442 \u0442\u043e\u0433\u043e, \u043a\u0430\u043a \u044f \u0441\u0442\u0440\u0430\u0434\u0430\u043b \u0440\u0430\u043d\u0435\u0435 \u0438 \u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u0442\u0440\u0430\u043d\u043d\u043e\u0433\u043e bash-\u043a\u043e\u0434\u0430 \u0440\u043e\u0434\u0438\u043b.<\/p>\n<p>\u041a\u043e\u043d\u0435\u0447\u043d\u043e, \u044f \u043d\u0435 \u043f\u0435\u0440\u0432\u044b\u0439 \u043a\u0442\u043e \u0437\u0430\u0434\u0443\u043c\u044b\u0432\u0430\u0435\u0442\u0441\u044f \u043e \u043f\u043e\u0434\u043e\u0431\u043d\u043e\u043c. \u0423\u0436\u0435 \u0434\u0430\u0436\u0435 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u0435\u0442 \u0446\u0435\u043b\u044b\u0439 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a <a href=\"https:\/\/vunit.github.io\/\" rel=\"noopener noreferrer nofollow\">VUnit<\/a>. \u041e\u0434\u043d\u0430\u043a\u043e, \u043a\u0430\u043a \u043f\u043e\u043a\u0430\u0437\u044b\u0432\u0430\u0435\u0442 \u043f\u0440\u0430\u043a\u0442\u0438\u043a\u0430 \u0438 \u043e\u043f\u0440\u043e\u0441\u044b \u0432 \u043f\u0440\u043e\u0444\u0438\u043b\u044c\u043d\u044b\u0445 \u0447\u0430\u0442\u0430\u0445, \u0442\u0430\u043a\u0438\u0435 \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0438 \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044e\u0442\u0441\u044f \u043d\u0435\u0447\u0430\u0441\u0442\u043e. \u0412\u0435\u0440\u043e\u044f\u0442\u043d\u043e \u043f\u043e\u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u043e\u043d\u0438 \u043f\u0440\u0435\u0434\u044a\u044f\u0432\u043b\u044f\u044e\u0442 \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u044f \u043a \u0432\u043d\u0443\u0442\u0440\u0435\u043d\u043d\u0435\u0439 \u0441\u0442\u0440\u0443\u043a\u0442\u0443\u0440\u0435 \u0441\u0430\u043c\u0438\u0445 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439, \u0441 \u0447\u0435\u043c \u043d\u0430\u0432\u0435\u0440\u043d\u043e\u0435 \u043c\u043e\u0436\u043d\u043e \u043c\u0438\u0440\u0438\u0442\u044c\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043d\u0430 \u043d\u043e\u0432\u044b\u0445 \u043f\u0440\u043e\u0435\u043a\u0442\u0430\u0445, \u0431\u0435\u0437 \u043e\u0431\u0448\u0438\u0440\u043d\u043e\u0439 \u043a\u043e\u0434\u043e\u0432\u043e\u0439 \u0431\u0430\u0437\u044b. \u041d\u0443 \u0438 \u0432\u043e\u043e\u0431\u0449\u0435, \u043a\u0443\u0434\u0430 \u0436 \u0431\u0435\u0437 \u0442\u0430\u043a\u0438\u0445 \u0432\u0435\u0449\u0435\u0439 \u043a\u0430\u043a &#171;\u0443 \u043d\u0430\u0441 \u0442\u0430\u043a \u043d\u0435 \u043f\u0440\u0438\u043d\u044f\u0442\u043e&#187; \u0438 &#171;not invented here&#187;.<\/p>\n<p>\u0421\u043e\u0431\u0441\u0442\u0432\u0435\u043d\u043d\u043e, \u0440\u0435\u0447\u044c \u043f\u043e\u0439\u0434\u0435\u0442 \u043d\u0435 \u043e \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u0438 \u043e\u0447\u0435\u0440\u0435\u0434\u043d\u043e\u0433\u043e \u0444\u0440\u0435\u0439\u043c\u0432\u043e\u0440\u043a\u0430, \u0430 \u043f\u0440\u043e\u0441\u0442\u043e \u043e \u0437\u0430\u043c\u0435\u043d\u0435 \u043e\u0434\u043d\u0438\u0445 \u0441\u043a\u0440\u0438\u043f\u0442\u043e\u0432 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u043d\u0430 \u0434\u0440\u0443\u0433\u0438\u0435, \u0431\u043e\u043b\u0435\u0435 \u0434\u0440\u0443\u0436\u0435\u043b\u044e\u0431\u043d\u044b\u0435 \u043a \u0440\u0430\u0441\u0448\u0438\u0440\u0435\u043d\u0438\u044e \u0438 \u043f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0435. \u0411\u0435\u0437 \u043a\u0430\u043a\u0438\u0445-\u043b\u0438\u0431\u043e \u0442\u0440\u0435\u0431\u043e\u0432\u0430\u043d\u0438\u0439 \u043a \u043a\u043e\u0434\u0443, \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430\u043c \u0438 \u0430\u0440\u0445\u0438\u0442\u0435\u043a\u0442\u0443\u0440\u0435 \u0438\u0445 \u043f\u043e\u0441\u0442\u0440\u043e\u0435\u043d\u0438\u044f.<\/p>\n<h3>\u0417\u0430\u0434\u0430\u0447\u0438<\/h3>\n<p>\u041f\u043e\u043f\u0440\u043e\u0431\u0443\u044e \u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0438\u0442\u044c \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u043e \u0437\u0430\u0434\u0430\u0447, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0442\u0430\u043a \u0438\u043b\u0438 \u0438\u043d\u0430\u0447\u0435 \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u044e\u0442 \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435 \u0440\u0430\u0437\u0440\u0430\u0431\u043e\u0442\u043a\u0438 \u0438 \u044d\u0432\u043e\u043b\u044e\u0446\u0438\u0438 HDL \u043f\u0440\u043e\u0435\u043a\u0442\u0430. \u041e\u0442 \u0431\u043e\u043b\u0435\u0435 \u043f\u0440\u043e\u0441\u0442\u044b\u0445 \u043a \u0431\u043e\u043b\u0435\u0435 \u0441\u043b\u043e\u0436\u043d\u044b\u043c:<\/p>\n<ul>\n<li>\n<p>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u0417\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430, \u043f\u043e\u0441\u043c\u043e\u0442\u0440\u0435\u0442\u044c \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0435 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c\u044b, \u0432\u043d\u0435\u0441\u0442\u0438 \u043a\u043e\u0440\u0440\u0435\u043a\u0442\u0438\u0432\u044b, \u043f\u043e\u0432\u0442\u043e\u0440\u0438\u0442\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0435\u0437 GUI. \u0422\u043e \u0436\u0435 \u0441\u0430\u043c\u043e\u0435, \u043d\u043e \u0431\u0435\u0437 \u0432\u0440\u0435\u043c\u0435\u043d\u043d\u044b\u0445 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c, \u043e\u0446\u0435\u043d\u0438\u0442\u044c \u0440\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442 \u043f\u043e \u0432\u044b\u0432\u043e\u0434\u0443 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c.<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u0417\u0430\u043f\u0443\u0441\u043a \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u0441 GUI \u0438\u043b\u0438 \u0431\u0435\u0437, \u043d\u043e \u0441 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430\u043c\u0438 (\u0434\u0435\u0444\u0430\u0439\u043d\u0430\u043c\u0438), \u043f\u0435\u0440\u0435\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u043c\u0438 \u0432 \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438.<\/p>\n<\/li>\n<li>\n<p>\u0417\u0430\u043f\u0443\u0441\u043a \u0441 \u043f\u0440\u0435-\/\u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u043e\u043c. \u041d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u043e\u0434\u0433\u043e\u0442\u043e\u0432\u043b\u0435\u043d\u044b \u0434\u0430\u043d\u043d\u044b\u0435. \u0418\u043b\u0438 \u0441\u0430\u043c \u0442\u0435\u0441\u0442 \u043f\u043e\u0440\u043e\u0436\u0434\u0430\u0435\u0442 \u0434\u0430\u043d\u043d\u044b\u0435, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u043e\u0432\u0435\u0440\u0435\u043d\u044b \u0432\u043d\u0435 HDL.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u041f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0432\u0441\u0435\u0445 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u0443\u044e\u0449\u0438\u0445 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a. \u041f\u0440\u043e\u0433\u043d\u0430\u0442\u044c \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0432\u0441\u0435\u0445 \u0438\u043b\u0438 \u0433\u0440\u0443\u043f\u043f\u044b \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439, \u043f\u0440\u0438 \u044d\u0442\u043e\u043c \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u044b\u0435 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0438 \u043c\u043e\u0433\u0443\u0442 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0442\u044c\u0441\u044f \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0440\u0430\u0437 \u0441 \u0440\u0430\u0437\u043d\u044b\u043c \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0435\u043c \u043a\u043b\u044e\u0447\u0435\u0432\u043e\u0433\u043e \u043f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0430 (\u0440\u0430\u0437\u043c\u0435\u0440\u043d\u043e\u0441\u0442\u044c \u0448\u0438\u043d\u044b, \u0438\u043d\u0442\u0435\u0440\u0444\u0435\u0439\u0441 \u0438 \u0442.\u0434).<\/p>\n<\/li>\n<li>\n<p>\u041f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u044b\u0435 \u0437\u0430\u043f\u0443\u0441\u043a\u0438. \u0422\u0435\u0441\u0442\u044b \u043c\u043e\u0433\u0443\u0442 \u043b\u0435\u0433\u043a\u043e \u0438\u0434\u0442\u0438 \u043c\u0438\u043d\u0443\u0442\u044b\/\u0447\u0430\u0441\u044b \u0438 \u043f\u043e\u0441\u043b\u0435\u0434\u043e\u0432\u0430\u0442\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043c\u043e\u0436\u0435\u0442 \u0437\u0430\u043d\u0438\u043c\u0430\u0442\u044c \u0441\u043b\u0438\u0448\u043a\u043e\u043c \u043c\u043d\u043e\u0433\u043e \u0432\u0440\u0435\u043c\u0435\u043d\u0438. \u0421\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043e\u043b\u0436\u043d\u044b \u043f\u043e\u0437\u0432\u043e\u043b\u044f\u0442\u044c \u043f\u0430\u0440\u0430\u043b\u043b\u0435\u043b\u044c\u043d\u043e\u0435 \u0438\u0441\u043f\u043e\u043b\u043d\u0435\u043d\u0438\u0435 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u043e\u0432. \u0421\u0434\u0435\u043b\u0430\u0442\u044c \u0442\u0430\u043a, \u0447\u0442\u043e\u0431\u044b \u0432\u0441\u0451 \u0432\u044b\u0448\u0435\u043f\u0435\u0440\u0435\u0447\u0438\u0441\u043b\u0435\u043d\u043d\u043e\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u043b\u043e \u0432 \u0440\u0430\u0437\u043d\u044b\u0445 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430\u0445.<\/p>\n<\/li>\n<li>\n<p>\u041f\u043e\u0434\u0434\u0435\u0440\u0436\u043a\u0430 CI. \u041c\u0430\u0441\u0441\u043e\u0432\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0434\u043e\u043b\u0436\u0435\u043d \u0441\u043e\u0447\u0435\u0442\u0430\u0442\u044c\u0441\u044f \u0432 \u0442\u043e\u043c \u0447\u0438\u0441\u043b\u0435 \u0441 \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0439 \u0441\u0442\u0440\u0430\u0442\u0435\u0433\u0438\u0435\u0439 CI (\u043f\u0440\u043e\u0433\u043e\u043d \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430, &#171;\u043d\u043e\u0447\u043d\u044b\u0435 \u0441\u0431\u043e\u0440\u043a\u0438&#187; \u0438 \u0442.\u0434.).<\/p>\n<\/li>\n<\/ul>\n<p>\u041d\u0443 \u0438 \u0434\u043e\u043f\u043e\u043b\u043d\u0438\u0442\u0435\u043b\u044c\u043d\u0430\u044f \u0437\u0430\u0434\u0430\u0447\u0430, \u043a\u043e\u0442\u043e\u0440\u0430\u044f \u0432\u043e\u0437\u043d\u0438\u043a\u0430\u0435\u0442 \u0432\u0441\u0435\u0433\u0434\u0430, \u043a\u043e\u0433\u0434\u0430 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u0442\u0441\u044f \u0431\u043e\u043b\u0435\u0435 \u043e\u0434\u043d\u043e\u0433\u043e \u0442\u0435\u0441\u0442\u0430 \u0437\u0430 \u0440\u0430\u0437 &#8212; \u043d\u0443\u0436\u0435\u043d \u0438\u043d\u0441\u0442\u0440\u0443\u043c\u0435\u043d\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0443\u043a\u0430\u0436\u0435\u0442 \u043a\u0430\u043a\u043e\u0439 \u0442\u0435\u0441\u0442 \u043f\u0440\u043e\u0448\u0435\u043b, \u043a\u0430\u043a\u043e\u0439 \u043d\u0435\u0442 \u0438 \u043f\u043e \u043a\u0430\u043a\u043e\u0439 \u043f\u0440\u0438\u0447\u0438\u043d\u0435.<\/p>\n<h3>\u0418\u0434\u0435\u044f<\/h3>\n<p>\u0412\u0441\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u044e\u0442\u0441\u044f \u043f\u0440\u0438\u043c\u0435\u0440\u043d\u043e \u043e\u0434\u0438\u043d\u0430\u043a\u043e\u0432\u043e \u0432 \u0431\u043e\u043b\u044c\u0448\u0438\u043d\u0441\u0442\u0432\u0435 \u0441\u043b\u0443\u0447\u0430\u0435\u0432:<\/p>\n<ul>\n<li>\n<p>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 (\u043e\u043f\u0446\u0438\u043e\u043d\u0430\u043b\u044c\u043d\u043e \u0434\u0435\u043b\u0438\u043c \u043d\u0430 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u043e \u0441\u043f\u0438\u0441\u043a\u043e\u0432 \u043f\u043e \u044f\u0437\u044b\u043a\u0443);<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0439 \u0434\u043b\u044f \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 (\u043d\u0443\u0436\u043d\u043e \u0434\u043b\u044f include);<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u0431\u0438\u0440\u0430\u0435\u043c \u0441\u043f\u0438\u0441\u043e\u043a \u0432\u0441\u0435\u0445 \u0434\u0435\u0444\u0430\u0439\u043d\u043e\u0432;<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0438\u043c\u044f \u0431\u0438\u0431\u043b\u0438\u043e\u0442\u0435\u043a\u0438, \u043a\u0443\u0434\u0430 \u0432\u0441\u0451 \u0431\u0443\u0434\u0435\u043c \u043a\u043e\u043c\u043f\u0438\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c (\u0438\u043b\u0438 \u043d\u0435\u0441\u043a\u043e\u043b\u044c\u043a\u0438\u0445);<\/p>\n<\/li>\n<li>\n<p>\u0441\u043e\u043e\u0431\u0449\u0430\u0435\u043c \u0438\u043c\u044f \u0432\u0435\u0440\u0445\u043d\u0435\u0433\u043e \u043c\u043e\u0434\u0443\u043b\u044f (\u043e\u0431\u044b\u0447\u043d\u043e \u044d\u0442\u043e \u0438\u043c\u044f \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430);<\/p>\n<\/li>\n<li>\n<p>\u043f\u0435\u0440\u0435\u0434\u0430\u0451\u043c \u044d\u0442\u043e \u0432\u0441\u0451 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0443 \u0432 \u0432\u0438\u0434\u0435 \u043a\u043b\u044e\u0447\u0435\u0439, \u0444\u0430\u0439\u043b\u043e\u0432 \u0441\u043e \u0441\u043f\u0438\u0441\u043a\u0430\u043c\u0438 \u0438 \u0442.\u0434.<\/p>\n<\/li>\n<\/ul>\n<p>\u0410 \u0447\u0442\u043e \u0435\u0441\u043b\u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u0442\u044c \u043c\u043e\u0434\u0443\u043b\u044c \u043d\u0430 Python, \u0432 \u043a\u043e\u0442\u043e\u0440\u043e\u043c \u043e\u0431\u0435\u0440\u043d\u0443\u0442\u044c \u043d\u0443\u0436\u043d\u044b\u0435 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u044b \u0432 \u043e\u0434\u0438\u043d \u043a\u043b\u0430\u0441\u0441 <code>Simulator<\/code>, \u0432\u044b\u043d\u0435\u0441\u0442\u0438 \u043e\u0431\u0449\u0438\u0435 \u0432\u0435\u0449\u0438 \u0432 \u0430\u0442\u0440\u0438\u0431\u0443\u0442\u044b \u0438 \u0440\u0435\u0430\u043b\u0438\u0437\u043e\u0432\u0430\u0442\u044c \u043c\u0435\u0442\u043e\u0434 <code>run()<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044e \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0432\u044b\u0431\u0440\u0430\u043d\u043d\u043e\u0433\u043e \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0430? \u0412 \u0446\u0435\u043b\u043e\u043c, \u0438\u043c\u0435\u043d\u043d\u043e \u044d\u0442\u043e \u044f \u0438 \u0441\u0434\u0435\u043b\u0430\u043b \u0434\u043b\u044f Icarus Verilog, Modelsim \u0438 Vivado Simulator, \u0438\u0441\u043f\u043e\u043b\u044c\u0437\u0443\u044f \u043c\u043e\u0434\u0443\u043b\u044c <code>subprocess<\/code>\u043f\u043e\u0434 \u043a\u0430\u043f\u043e\u0442\u043e\u043c. \u0422\u0430\u043a\u0436\u0435 \u044f \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u043a\u043b\u0430\u0441\u0441 <code>CliArgs<\/code>, \u043e\u0441\u043d\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u043d\u0430 \u043c\u043e\u0434\u0443\u043b\u0435 <code>argparse<\/code>, \u0447\u0442\u043e\u0431\u044b \u0438\u043c\u0435\u0442\u044c \u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e\u0441\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u044f\u0442\u044c \u0437\u0430\u043f\u0443\u0441\u043a\u043e\u043c \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u041d\u0443 \u0438 \u043d\u0430\u043f\u0438\u0441\u0430\u043b \u043d\u0435\u043a\u043e\u0442\u043e\u0440\u043e\u0435 \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u0432\u0441\u043f\u043e\u043c\u043e\u0433\u0430\u0442\u0435\u043b\u044c\u043d\u044b\u0445 \u0444\u0443\u043d\u043a\u0446\u0438\u0439, \u043a\u043e\u0442\u043e\u0440\u044b\u0435 \u043f\u0440\u0438\u0433\u043e\u0434\u044f\u0442\u0441\u044f \u0432 \u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0435. \u041f\u043e\u043b\u0443\u0447\u0438\u043b\u0441\u044f \u0444\u0430\u0439\u043b <a href=\"https:\/\/github.com\/esynr3z\/pyhdlsim\/blob\/master\/sim\/sim.py\" rel=\"noopener noreferrer nofollow\">sim.py<\/a>.<\/p>\n<p>\u0424\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438, \u044f \u043f\u043e\u0441\u0442\u0430\u0440\u0430\u043b\u0441\u044f \u0441\u0432\u0435\u0441\u0442\u0438 \u0432\u0441\u0451 \u043a \u0442\u043e\u043c\u0443, \u0447\u0442\u043e \u0432 \u043d\u043e\u0432\u043e\u043c \u043f\u0440\u043e\u0435\u043a\u0442\u0435 \u043d\u0443\u0436\u043d\u043e \u0432\u0441\u0435\u0433\u043e-\u043b\u0438\u0448\u044c \u0437\u0430\u043a\u0438\u043d\u0443\u0442\u044c \u044d\u0442\u043e\u0442 \u0444\u0430\u0439\u043b, \u0441\u043e\u0437\u0434\u0430\u0442\u044c \u0440\u044f\u0434\u043e\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0441\u043a\u0440\u0438\u043f\u0442 \u043d\u0430 Python, \u0438\u043c\u043f\u043e\u0440\u0442\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u043d\u0435\u043e\u0431\u0445\u043e\u0434\u0438\u043c\u043e\u0435 \u0438\u0437 <code>sim.py<\/code> \u0438 \u043d\u0430\u0447\u0430\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443.<\/p>\n<h3>\u0422\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u043f\u0440\u043e\u0435\u043a\u0442<\/h3>\n<p>\u0414\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u044f \u0432\u044b\u0442\u044f\u043d\u0443\u043b \u043c\u043e\u0434\u0443\u043b\u044c \u043f\u043e\u0448\u0430\u0433\u043e\u0432\u043e\u0433\u043e \u0432\u044b\u0447\u0438\u0441\u043b\u0435\u043d\u0438\u044f \u043a\u0432\u0430\u0434\u0440\u0430\u0442\u043d\u043e\u0433\u043e \u043a\u043e\u0440\u043d\u044f \u0438\u0437 \u043e\u0434\u043d\u043e\u0433\u043e \u0441\u0442\u0430\u0440\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430, \u0447\u0442\u043e\u0431\u044b \u0442\u0435\u0441\u0442\u043e\u0432\u044b\u0439 \u0434\u0438\u0437\u0430\u0439\u043d \u0431\u044b\u043b \u0445\u043e\u0442\u044c \u0447\u0443\u0442\u043e\u0447\u043a\u0443 \u0441\u043b\u043e\u0436\u043d\u0435\u0435 \u0441\u0447\u0451\u0442\u0447\u0438\u043a\u0430 \u0438\u043b\u0438 \u0441\u0443\u043c\u043c\u0430\u0442\u043e\u0440\u0430. \u041a\u043e\u0434 \u043e\u0441\u043d\u043e\u0432\u0430\u043d \u043d\u0430 \u043f\u0443\u0431\u043b\u0438\u043a\u0430\u0446\u0438\u0438 <a href=\"https:\/\/www.researchgate.net\/publication\/2532597_An_FPGA_Implementation_of_a_Fixed-Point_Square_Root_Operation\" rel=\"noopener noreferrer nofollow\">An FPGA Implementation of a Fixed-Point Square Root Operation<\/a>.<\/p>\n<figure class=\"full-width\"><figcaption><\/figcaption><\/figure>\n<p>\u0420\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0439 \u043f\u0440\u043e\u0435\u043a\u0442\u0430 <a href=\"https:\/\/github.com\/esynr3z\/pyhdlsim\" rel=\"noopener noreferrer nofollow\">pyhdlsim \u043d\u0430 GitHub<\/a>.<\/p>\n<p>\u0418\u0435\u0440\u0430\u0440\u0445\u0438\u044f \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043f\u0440\u043e\u0441\u0442\u0430:<\/p>\n<pre><code>$ tree -a -I .git . \u251c\u2500\u2500 .github \u2502   \u2514\u2500\u2500 workflows # Github Actions \u2502       \u251c\u2500\u2500 icarus-test.yml # \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 Icarus Verilog \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430 \u043d\u0430 github \u2502       \u2514\u2500\u2500 modelsim-test.yml # \u0437\u0430\u043f\u0443\u0441\u043a \u0432\u0441\u0435\u0445 \u0442\u0435\u0441\u0442\u043e\u0432 \u0432 Modelsim \u043f\u043e\u0441\u043b\u0435 \u043a\u0430\u0436\u0434\u043e\u0433\u043e \u043f\u0443\u0448\u0430 \u043d\u0430 github \u251c\u2500\u2500 .gitignore \u251c\u2500\u2500 LICENSE.txt \u251c\u2500\u2500 README.md \u251c\u2500\u2500 sim # \u0441\u043a\u0440\u0438\u043f\u0442\u044b \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0441\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u0438 \u2502   \u251c\u2500\u2500 conftest.py \u2502   \u251c\u2500\u2500 sim.py \u2502   \u2514\u2500\u2500 test_sqrt.py \u2514\u2500\u2500 src # \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u0438     \u251c\u2500\u2500 beh # \u043f\u043e\u0432\u0435\u0434\u0435\u043d\u0447\u0435\u0441\u0438\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0438 \u043c\u043e\u0434\u0435\u043b\u0438     \u2502   \u2514\u2500\u2500 sqrt.py     \u251c\u2500\u2500 rtl # \u0441\u0438\u043d\u0442\u0435\u0437\u0438\u0440\u0443\u0435\u043c\u044b\u0439 HDL \u043a\u043e\u0434     \u2502   \u2514\u2500\u2500 sqrt.v     \u2514\u2500\u2500 tb # HDL \u043a\u043e\u0434 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0435\u0439         \u2514\u2500\u2500 tb_sqrt.sv <\/code><\/pre>\n<p>\u0421\u0430\u043c \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447 <code>tb_sqrt.sv<\/code> \u0442\u043e\u0436\u0435 \u0434\u043e\u0432\u043e\u043b\u044c\u043d\u043e \u043f\u0440\u0438\u043c\u0438\u0442\u0438\u0432\u0435\u043d: \u043f\u043e\u0434\u0433\u043e\u0442\u0430\u0432\u043b\u0438\u0432\u0430\u0435\u0442\u0441\u044f \u043c\u0430\u0441\u0441\u0438\u0432 \u0432\u0445\u043e\u0434\u043d\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439, \u0432\u044b\u0447\u0438\u0441\u043b\u044f\u044e\u0442\u0441\u044f &#171;\u0438\u0434\u0435\u0430\u043b\u044c\u043d\u044b\u0435&#187; \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>$sqrt()<\/code>, \u0432\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u043f\u0440\u043e\u0442\u0430\u043b\u043a\u0438\u0432\u0430\u044e\u0442\u0441\u044f \u0432 \u043c\u043e\u0434\u0443\u043b\u044c \u043a\u043e\u0440\u043d\u044f, \u0432\u044b\u0445\u043e\u0434\u043d\u044b\u0435 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u044f \u0441\u043e\u0445\u0440\u0430\u043d\u044f\u044e\u0442\u0441\u044f \u0432 \u043c\u0430\u0441\u0441\u0438\u0432, \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442 \u0441\u0440\u0430\u0432\u043d\u0435\u043d\u0438\u0435 \u043e\u0436\u0438\u0434\u0430\u0435\u043c\u044b\u0445 \u0437\u043d\u0430\u0447\u0435\u043d\u0438\u0439 \u0438 \u0444\u0430\u043a\u0442\u0438\u0447\u0435\u0441\u043a\u0438\u0445.<\/p>\n<p>\u0412 \u043f\u0440\u0438\u043d\u0446\u0438\u043f\u0435, \u043a\u0440\u0430\u0442\u043a\u043e\u0435 \u043e\u043f\u0438\u0441\u0430\u043d\u0438\u0435 \u0435\u0441\u0442\u044c \u0432 \u0441\u0430\u043c\u043e\u043c \u0440\u0435\u043f\u043e\u0437\u0438\u0442\u043e\u0440\u0438\u0438 \u0438 \u043d\u0430 \u044d\u0442\u043e\u043c \u043c\u043e\u0436\u043d\u043e \u0437\u0430\u043a\u0440\u0443\u0433\u043b\u044f\u0442\u044c\u0441\u044f, \u043e\u0434\u043d\u0430\u043a\u043e, \u0434\u0443\u043c\u0430\u044e \u0447\u0442\u043e \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0440\u0430\u0437\u0434\u043e \u043d\u0430\u0433\u043b\u044f\u0434\u043d\u0435\u0435, \u0435\u0441\u043b\u0438 \u043f\u043e\u043a\u0430\u0437\u0430\u0442\u044c \u0432\u0435\u0441\u044c \u043f\u0443\u0442\u044c \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u0438\u044f \u0442\u0435\u0441\u0442\u043e\u0432\u043e\u0433\u043e \u043e\u043a\u0440\u0443\u0436\u0435\u043d\u0438\u044f (\u0431\u0443\u0434\u0435\u043c \u0441\u0447\u0438\u0442\u0430\u0442\u044c \u0447\u0442\u043e \u0432\u0435\u0441\u044c HDL \u0438 \u0444\u0430\u0439\u043b <code>sim.py<\/code> \u0443\u0436\u0435 \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u044b). \u0412\u0441\u0451 \u0434\u0435\u0439\u0441\u0442\u0432\u043e \u0431\u0443\u0434\u0435\u0442 \u043f\u0440\u043e\u0438\u0441\u0445\u043e\u0434\u0438\u0442\u044c \u0432\u043d\u0443\u0442\u0440\u0438 \u043f\u0430\u043f\u043a\u0438 <code>sim<\/code>. \u041e\u0441\u0442\u043e\u0440\u043e\u0436\u043d\u043e, \u0431\u0443\u043a\u0432 \u043c\u043d\u043e\u0433\u043e \u0432\u043f\u0435\u0440\u0435\u0434\u0438 \u043e\u0436\u0438\u0434\u0430\u0435\u0442.<\/p>\n<h3>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0421\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u0444\u0430\u0439\u043b <code>test_sqrt.py<\/code> \u0434\u043b\u044f \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  from sim import Simulator  sim = Simulator(name='icarus', gui=True, cwd='work') sim.incdirs += [\"..\/src\/tb\", \"..\/src\/rtl\", sim.cwd] sim.sources += [\"..\/src\/rtl\/sqrt.v\", \"..\/src\/tb\/tb_sqrt.sv\"] sim.top = \"tb_sqrt\" sim.setup() sim.run()<\/code><\/pre>\n<p>\u0422\u0435\u0441\u0442 \u0431\u0443\u0434\u0435\u043c \u043f\u0440\u043e\u0433\u043e\u043d\u044f\u0442\u044c \u0432 Icarus \u0441 \u043e\u0442\u043a\u0440\u044b\u0442\u0438\u0435\u043c GTKWave \u0434\u043b\u044f \u043f\u0440\u043e\u0441\u043c\u043e\u0442\u0440\u0430 \u0434\u0438\u0430\u0433\u0440\u0430\u043c\u043c. \u041f\u0443\u0442\u0438 \u0434\u043e \u0438\u0441\u0445\u043e\u0434\u043d\u0438\u043a\u043e\u0432 \u0437\u0430\u0434\u0430\u044e\u0442\u0441\u044f \u043e\u0442\u043d\u043e\u0441\u0438\u0442\u0435\u043b\u044c\u043d\u043e \u0441\u0430\u043c\u043e\u0433\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430. \u0417\u0430\u0434\u0430\u0432\u0430\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u0438 \u043f\u043e\u0438\u0441\u043a\u0430 \u0438\u043d\u043a\u043b\u0443\u0434\u043e\u0432 \u0434\u043b\u044f \u0434\u0430\u043d\u043d\u043e\u0433\u043e \u043f\u0440\u043e\u0435\u043a\u0442\u0430 \u043d\u0435 \u043e\u0431\u044f\u0437\u0430\u0442\u0435\u043b\u044c\u043d\u043e, \u0438 \u0441\u0434\u0435\u043b\u0430\u043d\u043e \u043b\u0438\u0448\u044c \u0434\u043b\u044f \u0434\u0435\u043c\u043e\u043d\u0441\u0442\u0440\u0430\u0446\u0438\u0438. \u0427\u0442\u043e\u0431\u044b \u043d\u0435 \u0437\u0430\u0433\u0440\u044f\u0437\u043d\u044f\u0442\u044c \u0434\u0438\u0440\u0435\u043a\u0442\u043e\u0440\u0438\u044e \u0441\u043e \u0441\u043a\u0440\u0438\u043f\u0442\u0430\u043c\u0438 &#8212; \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e <code>sim.setup()<\/code> \u0431\u0443\u0434\u0435\u0442 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0440\u0430\u0431\u043e\u0447\u0430\u044f \u043f\u0430\u043f\u043a\u0430 <code>work<\/code> (\u0430 \u0435\u0441\u043b\u0438 \u043e\u043d\u0430 \u0441\u0443\u0449\u0435\u0441\u0442\u0432\u043e\u0432\u0430\u043b\u0430, \u0442\u043e \u043e\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u0443\u0434\u0430\u043b\u0435\u043d\u0430 \u0438 \u0441\u043e\u0437\u0434\u0430\u043d\u0430 \u0437\u0430\u043d\u043e\u0432\u043e) \u0432\u043d\u0443\u0442\u0440\u0438 \u043a\u043e\u0442\u043e\u0440\u043e\u0439 \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440 \u0438 \u0431\u0443\u0434\u0435\u0442 \u0437\u0430\u043f\u0443\u0449\u0435\u043d (<code>sim.run()<\/code>).<\/p>\n<p>\u0414\u0435\u043b\u0430\u0435\u043c \u0441\u043a\u0440\u0438\u043f\u0442 \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c\u044b\u043c \u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u0435\u043c:<\/p>\n<pre><code>chmod +x test_sqrt.py .\/test_sqrt.py<\/code><\/pre>\n<p>\u0421\u0438\u043c\u0443\u043b\u044f\u0446\u0438\u044f \u0434\u043e\u043b\u0436\u043d\u0430 \u043f\u0440\u043e\u0439\u0442\u0438 \u0443\u0441\u043f\u0435\u0448\u043d\u043e \u0438 \u0434\u043e\u043b\u0436\u043d\u043e \u043f\u043e\u044f\u0432\u0438\u0442\u044c\u0441\u044f \u043e\u043a\u043d\u043e GTKWave.<\/p>\n<h3>\u041e\u0434\u0438\u043d\u043e\u0447\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a \u0431\u0435\u0437 GUI<\/h3>\n<p>\u041c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0435\u0447\u043d\u043e \u0431\u0435\u0437 \u043a\u043e\u043d\u0446\u0430 \u043f\u0440\u0430\u0432\u0438\u0442\u044c \u0441\u0430\u043c \u0441\u043a\u0440\u0438\u043f\u0442, \u043d\u043e \u0431\u043e\u043b\u0435\u0435 \u0432\u0435\u0440\u043d\u044b\u043c \u0440\u0435\u0448\u0435\u043d\u0438\u0435\u043c \u0431\u0443\u0434\u0435\u0442 \u0434\u043e\u0431\u0430\u0432\u0438\u0442\u044c \u0443\u043f\u0440\u0430\u0432\u043b\u0435\u043d\u0438\u0435 \u0434\u0435\u0442\u0430\u043b\u044f\u043c\u0438 \u0437\u0430\u043f\u0443\u0441\u043a\u0430 \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438. \u0414\u043e\u0431\u0430\u0432\u043b\u044f\u0435\u043c \u043f\u0430\u0440\u0441\u0435\u0440 \u0430\u0440\u0433\u0443\u043c\u0435\u043d\u0442\u043e\u0432 <code>CliArgs<\/code>. \u0422\u0435\u0441\u0442 \u0432\u044b\u043d\u0435\u0441 \u0432 \u043e\u0442\u0434\u0435\u043b\u044c\u043d\u0443\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u044e \u0438 \u0434\u043e\u0431\u0430\u0432\u0438\u043b \u0441\u0442\u0430\u043d\u0434\u0430\u0440\u0442\u043d\u0443\u044e \u043f\u0440\u043e\u0432\u0435\u0440\u043a\u0443, \u0447\u0442\u043e\u0431\u044b \u043f\u0430\u0440\u0441\u0435\u0440 \u0437\u0430\u043f\u0443\u0441\u043a\u0430\u043b\u0441\u044f \u0442\u043e\u043b\u044c\u043a\u043e \u043a\u043e\u0433\u0434\u0430 \u043c\u044b \u043d\u0435\u043f\u043e\u0441\u0440\u0435\u0434\u0441\u0442\u0432\u0435\u043d\u043d\u043e \u0438\u0441\u043f\u043e\u043b\u043d\u044f\u0435\u043c \u0441\u0430\u043c \u0444\u0430\u0439\u043b.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  from sim import Simulator, CliArgs  def test(tmpdir, defines, simtool, gui):     sim = Simulator(name=simtool, gui=gui, cwd=tmpdir)     sim.incdirs += [\"..\/src\/tb\", \"..\/src\/rtl\", sim.cwd]     sim.sources += [\"..\/src\/rtl\/sqrt.v\", \"..\/src\/tb\/tb_sqrt.sv\"]     sim.defines += defines     sim.top = \"tb_sqrt\"     sim.setup()     sim.run()  if __name__ == '__main__':     # run script with key -h to see help     args = CliArgs(default_test=\"test\").parse()     test(tmpdir='work', simtool=args.simtool, gui=args.gui, defines=args.defines)<\/code><\/pre>\n<p>\u041f\u043e\u0441\u043c\u043e\u0442\u0440\u0438\u043c \u0447\u0442\u043e \u043d\u0430\u043c \u0434\u043e\u0441\u0442\u0443\u043f\u043d\u043e:<\/p>\n<pre><code class=\"bash\">$ .\/test_sqrt.py -h usage: test_sqrt.py [-h] [-t &lt;name&gt;] [-s &lt;name&gt;] [-b] [-d &lt;def&gt; [&lt;def&gt; ...]]  optional arguments:   -h, --help            show this help message and exit   -t &lt;name&gt;             test &lt;name&gt;; default is 'test'   -s &lt;name&gt;             simulation tool &lt;name&gt;; default is 'icarus'   -b                    enable batch mode (no GUI)   -d &lt;def&gt; [&lt;def&gt; ...]  define &lt;name&gt;; option can be used multiple times<\/code><\/pre>\n<p>\u0422\u0435\u043f\u0435\u0440\u044c \u043c\u044b \u043c\u043e\u0436\u0435\u043c \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0442\u0435\u0441\u0442 \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u044c\u043d\u043e\u043c \u0440\u0435\u0436\u0438\u043c\u0435:<\/p>\n<pre><code class=\"bash\">$ .\/test_sqrt.py -b Run Icarus (cwd=\/space\/projects\/pyhdlsim\/simtmp\/work) TOP_NAME=tb_sqrt SIM iverilog -I \/space\/projects\/pyhdlsim\/src\/tb -I \/space\/projects\/pyhdlsim\/src\/rtl -I \/space\/projects\/pyhdlsim\/simtmp\/work -D TOP_NAME=tb_sqrt -D SIM -g2005-sv -s tb_sqrt -o worklib.vvp \/space\/projects\/pyhdlsim\/src\/rtl\/sqrt.v \/space\/projects\/pyhdlsim\/src\/tb\/tb_sqrt.sv  vvp worklib.vvp -lxt2 LXT2 info: dumpfile dump.vcd opened for output. Test started. Will push 8 words to DUT. !@# TEST PASSED #@!<\/code><\/pre>\n<p>\u0418\u043b\u0438 \u0437\u0430\u043f\u0443\u0441\u0442\u0438\u0442\u044c \u0432 \u0434\u0440\u0443\u0433\u043e\u043c \u0441\u0438\u043c\u0443\u043b\u044f\u0442\u043e\u0440\u0435:<\/p>\n<pre><code class=\"bash\"># \u043a\u0430\u043a \u0432 \u043a\u043e\u043d\u0441\u043e\u043b\u0438 .\/test_sqrt.py -s modelsim -b # \u0442\u0430\u043a \u0438 \u0441 GUI .\/test_sqrt.py -s modelsim<\/code><\/pre>\n<h3>\u041f\u0430\u0440\u0430\u043c\u0435\u0442\u0440\u0438\u0437\u0438\u0440\u043e\u0432\u0430\u043d\u043d\u044b\u0439 \u0437\u0430\u043f\u0443\u0441\u043a<\/h3>\n<p>\u0422\u0430\u043a\u0436\u0435 \u0442\u0435\u043f\u0435\u0440\u044c \u043c\u043e\u0436\u043d\u043e \u043a\u043e\u043d\u0442\u0440\u043e\u043b\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0435\u0444\u0430\u0439\u043d\u044b \u0438\u0437 \u043a\u043e\u043d\u0441\u043e\u043b\u0438, \u0438, \u043d\u0430\u043f\u0440\u0438\u043c\u0435\u0440, \u0443\u0432\u0435\u043b\u0438\u0447\u0438\u0442\u044c \u043a\u043e\u043b\u0438\u0447\u0435\u0441\u0442\u0432\u043e \u043f\u043e\u0434\u0430\u0432\u0430\u0435\u043c\u044b\u0445 \u0434\u0430\u043d\u043d\u044b\u0445:<\/p>\n<pre><code class=\"bash\">$ .\/test_sqrt.py -b -d ITER_N=42 Run Icarus (cwd=\/space\/projects\/pyhdlsim\/simtmp\/work) TOP_NAME=tb_sqrt SIM iverilog -I \/space\/projects\/pyhdlsim\/src\/tb -I \/space\/projects\/pyhdlsim\/src\/rtl -I \/space\/projects\/pyhdlsim\/simtmp\/work -D TOP_NAME=tb_sqrt -D SIM -g2005-sv -s tb_sqrt -o worklib.vvp \/space\/projects\/pyhdlsim\/src\/rtl\/sqrt.v \/space\/projects\/pyhdlsim\/src\/tb\/tb_sqrt.sv  vvp worklib.vvp -lxt2 LXT2 info: dumpfile dump.vcd opened for output. Test started. Will push 42 words to DUT. !@# TEST PASSED #@!<\/code><\/pre>\n<h3>\u0417\u0430\u043f\u0443\u0441\u043a \u0441 \u043f\u0440\u0435-\/\u043f\u043e\u0441\u0442\u043f\u0440\u043e\u0446\u0435\u0441\u0441\u0438\u043d\u0433\u043e\u043c<\/h3>\n<p>\u0427\u0430\u0441\u0442\u043e \u0431\u044b\u0432\u0430\u0435\u0442 \u0442\u0430\u043a, \u0447\u0442\u043e \u0441\u0433\u0435\u043d\u0435\u0440\u0438\u0440\u043e\u0432\u0430\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0434\u043b\u044f \u0442\u0435\u0441\u0442\u0430 \u043d\u0435\u0432\u043e\u0437\u043c\u043e\u0436\u043d\u043e \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430 \u0438 \u0434\u043e\u043b\u0436\u043d\u044b \u0431\u044b\u0442\u044c \u043f\u0440\u0438\u043c\u0435\u043d\u0435\u043d\u044b \u0432\u043d\u0435\u0448\u043d\u0438\u0435 \u0433\u0435\u043d\u0435\u0440\u0430\u0442\u043e\u0440\u044b. \u0421\u0434\u0435\u043b\u0430\u0435\u043c \u0435\u0449\u0435 \u043e\u0434\u0438\u043d \u0442\u0435\u0441\u0442, \u0433\u0434\u0435 \u0431\u0443\u0434\u0435\u043c \u0441\u0432\u0435\u0440\u044f\u0442\u044c \u0440\u0430\u0431\u043e\u0442\u0443 \u043c\u043e\u0434\u0443\u043b\u044f \u043d\u0430 Verilog \u0441 \u0438\u0434\u0435\u0430\u043b\u044c\u043d\u043e\u0439 \u043c\u043e\u0434\u0435\u043b\u044c\u044e, \u043d\u0430\u043f\u0438\u0441\u0430\u043d\u043d\u043e\u0439 \u043d\u0430 Python. \u0410\u043b\u0433\u043e\u0440\u0438\u0442\u043c \u0440\u0430\u0431\u043e\u0442\u044b \u0443\u0436\u0435 \u0431\u044b\u043b \u043f\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u043b\u0435\u043d \u0432\u044b\u0448\u0435 &#8212; \u043f\u0440\u043e\u0441\u0442\u043e \u043f\u0435\u0440\u0435\u043f\u0438\u0448\u0435\u043c \u0435\u0433\u043e \u043d\u0430 Python, \u043d\u0435 \u0437\u0430\u0431\u044b\u0432\u0430\u044f \u043f\u0440\u043e\u0432\u0435\u0440\u0438\u0442\u044c \u0447\u0442\u043e \u043e\u043d \u043d\u0430 \u0441\u0430\u043c\u043e\u043c \u0434\u0435\u043b\u0435 \u0440\u0430\u0431\u043e\u0442\u0430\u0435\u0442. \u0420\u0435\u0437\u0443\u043b\u044c\u0442\u0430\u0442\u043e\u043c \u0431\u0443\u0434\u0435\u0442 \u0444\u0430\u0439\u043b <code>src\/beh\/sqrt.py<\/code>. \u041e\u0442\u0442\u0443\u0434\u0430 \u043d\u0430\u043c \u043d\u0443\u0436\u043d\u0430 \u0431\u0443\u0434\u0435\u0442 \u043b\u0438\u0448\u044c \u043e\u0434\u043d\u0430 \u0444\u0443\u043d\u043a\u0446\u0438\u044f <code>nrsqrt()<\/code>.<\/p>\n<p>\u041f\u0435\u0440\u0435\u0438\u043c\u0435\u043d\u0443\u0435\u043c \u0441\u0442\u0430\u0440\u044b\u0439 \u0442\u0435\u0441\u0442, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u043e\u0440\u0438\u0435\u043d\u0442\u0438\u0440\u0443\u0435\u0442\u0441\u044f \u043d\u0430 \u0434\u0430\u043d\u043d\u044b\u0435, \u043f\u043e\u043b\u0443\u0447\u0435\u043d\u043d\u044b\u0435 \u0432\u043d\u0443\u0442\u0440\u0438 \u0442\u0435\u0441\u0442\u0431\u0435\u043d\u0447\u0430, \u0432 <code>test_sv<\/code>. \u0418 \u0441\u043e\u0437\u0434\u0430\u0434\u0438\u043c \u043d\u043e\u0432\u044b\u0439 <code>test_py<\/code>, \u043a\u043e\u0442\u043e\u0440\u044b\u0439 \u0431\u0443\u0434\u0435\u0442 \u0433\u043e\u0442\u043e\u0432\u0438\u0442\u044c \u0434\u0430\u043d\u043d\u044b\u0435 \u0441 \u043f\u043e\u043c\u043e\u0449\u044c\u044e \u0444\u0443\u043d\u043a\u0446\u0438\u0438 <code>nrsqrt()<\/code>.<\/p>\n<pre><code class=\"python\">#!\/usr\/bin\/env python3  from sim import Simulator, CliArgs, path_join, write_memfile import random import<\/code><\/pre>\n<\/div>\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-316503","post","type-post","status-publish","format-standard","hentry"],"_links":{"self":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316503","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=316503"}],"version-history":[{"count":0,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=\/wp\/v2\/posts\/316503\/revisions"}],"wp:attachment":[{"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=316503"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=316503"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/savepearlharbor.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=316503"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}