verilog问题,, verilog 问题

verilog \u57fa\u672c\u95ee\u9898

\u8981\u6c42\u662f\u8bf4\u5728\u65f6\u949f\u4e0b\u964d\u6cbf\u6e05\u96f6\uff0c\u800c\u4e0d\u662f\u68c0\u6d4b\u5230\u65f6\u949f\u4e0b\u964d\u6cbf\u6e05\u96f6\u3002
\u4e5f\u5c31\u662f\u8bf4\uff0c\u68c0\u6d4b\u5230\u65f6\u949f\u4e0b\u964d\u6cbf\u7684\u65f6\u5019\uff0c\u5982\u679cCLR\u6709\u6548\u5219\u6e05\u96f6\u3002

\u81f3\u4e8e\u8981or\u4e00\u4e2a\u6e05\u96f6\u7684\u4e0a\u5347\u6cbf\uff0c\u6211\u4e2a\u4eba\u7684\u7406\u89e3\u662f\u56e0\u4e3a\u8fd9\u4e2a\u6a21\u5757\u7684\u524d\u9762\u8fd8\u6709\u4e00\u4e2aD\u89e6\u53d1\u5668\uff0c\u524d\u9762\u90a3\u4e2aD\u89e6\u53d1\u5668\u7684\u7ed3\u679cQ\u4f5c\u4e3a\u8fd9\u4e2a\u6a21\u5757\u7684D\u8f93\u5165\u3002\u800c\u524d\u9762\u90a3\u4e2aD\u89e6\u53d1\u5668\u7684\u65f6\u949fCLK\u548c\u6e05\u96f6\u4fe1\u53f7CLR\u4e5f\u88ab\u5f15\u5230\u8fd9\u4e2a\u6a21\u5757\u4e2d\uff0c\u4f7f\u524d\u540e\u4e24\u79cdD\u89e6\u53d1\u5668\u540c\u6b65\u5de5\u4f5c\u3002\u5f53\u524d\u9762\u7684D\u89e6\u53d1\u5668CLR\u6709\u6548\u6e05\u96f6\u7684\u65f6\u5019\uff0c\u540e\u9762\u7684D\u89e6\u53d1\u5668\u4e5f\u5e94\u8be5\u8ddf\u968f\u524d\u9762\u7684\u6e05\u96f6\u3002

\u4f60\u662f\u4e0d\u662f\u9519\u8bef\u63d0\u793a\uff1aError (10200): Verilog HDL Conditional Statement error at \u2026\u2026: cannot match operand(s) in the condition to the corresponding edges in the enclosing event control of the always construct
\u8fd9\u662f\u56e0\u4e3a\uff0c\u4f60\u7684\u201calways@(posedge clk or negedge r_est)\u201d\u8868\u660e\u5728clk\u4e0a\u5347\u6cbf\u6216r_est\u4e0b\u964d\u6cbf\u8fd9\u4e24\u4e2a\u654f\u611f\u4e8b\u4ef6\u53d1\u751f\u65f6always\u8bed\u53e5\u5757\u5f97\u4ee5\u89e6\u53d1\uff1b\u800calways\u4e2d\u7684if\u6761\u4ef6\u8bed\u53e5\u5fc5\u987b\u81f3\u5c11\u6709\u4e00\u4e2a\u6761\u4ef6\u6307\u5411\u5176\u4e2d\u4e00\u4e2a\u654f\u611f\u4e8b\u4ef6\uff08\u8fb9\u754c\u6807\u8bc6\u7b26\uff09\uff1b\u6240\u4ee5\u5199\u6210\u201cif\uff08r_est)...else...\u201d\u5c31\u4f1a\u51fa\u9519\u3002

\u4f60\u53ef\u4ee5\u628a\u201calways@(posedge clk or negedge r_est)\u201d\u6539\u4e3a\u201calways@(posedge clk or posedge r_est)\u201d\u518d\u7f16\u8bd1\u8bd5\u8bd5\uff0c\u5e94\u8be5\u5c31\u6ca1\u95ee\u9898\u4e86\u3002

\u4f60\u53f3\u952e\u8be5\u9519\u8bef\u70b9\u51fb\u201cHelp\u201d\u91cc\u662f\u8fd9\u4e48\u8bf4\u7684\uff1a
CAUSE: In a conditional statement at the specified location in a Verilog Design File (.v), you specified a condition that Quartus II Integrated Synthesis cannot use to classify the edges in the enclosing always construct's event control. When an event control contains multiple edges, Quartus II Integrated Synthesis distinguishes the asynchronous control signals from the clock by analyzing the conditional statements in the always construct. For example, the following code fragment contains an always construct whose event control contains three edges---two asynchronous resets and a clock.
always @ (posedge clk or posedge rst1 or posedge rst2)
begin
if ( rst1 || rst2 )
q <= 1'b0;
else
q <= d;
end
Quartus II Integrated Synthesis uses the if condition to identify the two asynchronous resets and, by implication, the clock. For edge classification, Quartus II Integrated Synthesis requires that a condition fall into one of two categories. It can refer to a single edge identifier (to match posedge events) or its complement (to match negedge events), for example, rst1, !rst1, rst1 == 1'b1, rst1 == 1'b0. It can also OR two or more expressions that each refer to a single edge identifier or its complement, for example, (rst1 || rst2), (!rst1 || !rst2).
You can receive this error if your condition tests for the wrong polarity, or if it tests for the value of a variable that is not an edge in the event control. For example, to match a posedge rst event, the condition must be rst or rst = 1'b1.
Finally, you can receive this error if you are attempting to use a single condition expression to test for both an asynchronous reset/set and a synchronous reset/set condition. The following code fragment contains an example of an illegal condition expression:
always @ (posedge clk or posedge rst)
begin
if ( rst || sync_rst )
q <= 1'b0;
else
q <= d;
end
Quartus II Integrated Synthesis generates this error message when compiling this design because it cannot match sync_rst to an edge on the sensitivity list.

\u5176\u4e2d\u5173\u952e\u7684\u8bed\u53e5\u6211\u6458\u8bd1\u4e00\u4e0b\uff0c\u4e0d\u4e00\u5b9a\u8bd1\u5f97\u51c6\u786e\uff0c\u4e0d\u8fc7\u5927\u4f53\u610f\u601d\u6211\u60f3\u4f60\u5e94\u8be5\u53ef\u4ee5\u4e86\u89e3\u4e86\uff1a
\u539f\u56e0\uff1a\u2026\u2026\u6307\u5b9a\u4e86\u4e00\u4e2a\u6761\u4ef6\uff0cQuartus II \u7efc\u5408\u5668\u4e0d\u80fd\u591f\u5c06\u8be5\u6761\u4ef6\u7528\u4e8e\u5728\u5c01\u95ed\u7684always\u7ed3\u6784\u7684\u4e8b\u4ef6\u63a7\u5236\u4e2d\u5bf9\u8fb9\u754c\u8fdb\u884c\u533a\u5206\u3002\u5f53\u4e00\u4e2a\u4e8b\u4ef6\u63a7\u5236\u4e2d\u5305\u542b\u591a\u91cd\u8fb9\u754c\uff0cQuartus II \u7efc\u5408\u5668\u901a\u8fc7\u5206\u6790always\u7ed3\u6784\u4e2d\u7684\u6761\u4ef6\u8bed\u53e5\u6765\u5bf9\u65f6\u949f\u548c\u5f02\u6b65\u63a7\u5236\u4fe1\u53f7\u52a0\u4ee5\u533a\u5206\u3002\u2026\u2026
Quartus II \u7efc\u5408\u5668\u91c7\u7528if\u6761\u4ef6\u6765\u9274\u522b\u4e24\u4e2a\u5f02\u6b65reset\u4fe1\u53f7\uff0c\u5e76\u9690\u542b\u5730\u9274\u522b\u4e86clock\u4fe1\u53f7\u3002\u4e3a\u4e86\u5206\u7c7b\u7684\u9700\u8981\uff0cQuartus II \u7efc\u5408\u5668\u9700\u8981\u6709\u4e00\u4e2a\u6761\u4ef6\u843d\u5165\u4e24\u4e2a\u7c7b\u522b\u4e4b\u4e00\u3002\u5b83\u53ef\u4ee5\u6307\u5411\u4e00\u4e2a\u5355\u72ec\u7684\u8fb9\u754c\u6807\u8bc6\u7b26\uff08\u4ee5\u5339\u914dposedge\u4e8b\u4ef6\uff09\u6216\u5b83\u7684\u8865\u8bed\uff08\u4ee5\u5339\u914dnegedge\u4e8b\u4ef6\uff09\uff0c\u4f8b\u5982\uff0c rst1, !rst1, rst1 == 1'b1, rst1 == 1'b0\u3002\u5b83\u4e5f\u53ef\u4ee5\u662fOR\u4e24\u4e2a\u6216\u66f4\u591a\u7684\u8868\u8fbe\u5f0f\uff0c\u5176\u4e2d\u6bcf\u4e00\u4e2a\u6307\u5411\u4e00\u4e2a\u5355\u72ec\u7684\u8fb9\u754c\u6807\u8bc6\u7b26\u6216\u5b83\u7684\u8865\u8bed\u2026\u2026
\u5f53\u4f60\u7684\u6761\u4ef6\u6d4b\u8bd5\u53d1\u73b0\u9519\u8bef\u6781\u6027\uff0c\u6216\u8005\u5b83\u6d4b\u8bd5\u53d8\u91cf\u7684\u503c\uff0c\u4f46\u8be5\u503c\u5728\u4e8b\u4ef6\u63a7\u5236\u4e2d\u5e76\u4e0d\u662f\u4e00\u4e2a\u8fb9\u754c\u65f6\uff0c\u4f60\u4f1a\u63a5\u5230\u8fd9\u4e2a\u9519\u8bef\u3002\u4f8b\u5982\uff0c\u4e3a\u4e86\u5339\u914d\u4e00\u4e2aposedge rst\u4e8b\u4ef6\uff0c\u6761\u4ef6\u5fc5\u987b\u662frst\u6216rst = 1'b1\u3002

\u7f16\u8bd1\u9519\u8bef\u65f6\u591a\u770b\u770bHelp\uff0c\u8bb2\u5f97\u5f88\u8be6\u7ec6~

这里要注意,C是两位的二进制数,而S1和S2是一位的二进制数,&是按位的与运算。按位的与运算如果参与运算的数据位数不等时,会先将其补完整。而补充的规则应是左边加0。

因此,

Y=S1&C=2'b01&2'b10=2'b00;

Y=((~S2)&C);=~2'b00&2'b10=2'b11&2'b10=2'b10;

特别说明,正常情况下不同位长的数据参加按位逻辑运算应该是有问题的,照理,EDA工具至少应该会报出Warning信息,以提示该语句存在的问题。



  • 鍏充簬Verilog璇█鐨闂
    绛旓細棣栧厛锛屼笉鑳藉湪澶氫釜杩涚▼涓鍚屼竴涓俊鍙疯祴鍊硷紝杩欎細寮曡捣绔炰簤銆傜紪璇戜篃浼氬嚭閿欍傚叾娆★紝灏介噺浣跨敤IF宓屽锛屼繚璇佷换鎰忔椂鍒诲彧鏈変竴涓狪F璇彞瀵圭洰鏍囪祴鍊笺傛垨鑰呬娇鐢–ASE璇彞銆傚鏋滀娇鐢ㄤ簡澶氫釜IF璇彞骞跺垪锛屽彧浼氬啀鏈鍚庝竴涓狪F璇彞瀵圭洰鏍囪祴鍊笺傛湜閲囩撼
  • verilog鐨勪竴涓潪甯哥畝鍗曠殑灏闂
    绛旓細always@(posedge clk)begin totalh={in1,in2};totall={in3,in4};end always@(negedge clk)begin if((in1||in2||in3||in4)==0)begin if (totalh!=0||totall!=0)begin SRCH=totalh;SRCL=totall;end end end 鎯宠鍏ヤ笂涓鏃跺埢鐨勫硷紝蹇呴』瑕佸姞鍏lock銆傜劧鍚庢瘡娆″湪鏃堕挓鐨勪笂鍗囨部鎶婅緭鍏ョ殑...
  • verilog涓瘎瀛樺櫒鐨勫垵濮嬪闂,
    绛旓細1銆侀鍏锛寁erilog鏄‖浠舵弿杩拌瑷锛屼笉鏄蒋浠剁紪绋嬭瑷锛屾墍浠ユ病鏈夆滄墽琛屸濈殑姒傚康锛屼篃娌℃湁鈥滈粯璁ゅ垵濮嬪尖濈殑姒傚康锛2銆佷綘杩欏嚑鍙ユ弿杩扮殑鏄竴涓粍鍚堥昏緫寰幆(combinational Loop)锛岃繖鏄‖浠惰璁¢噷鐨勯敊璇紝鍒濆鑰呭線寰浼氬嚭鐜拌繖绉嶉敊璇紱3銆佸鏋滈潪瑕佹妸浣犵殑涓滆タ鈥滆浆鍖栤濅负纭欢鐨勮瘽锛屽涓嬪浘鎵绀猴細...
  • verilog璇█闂涓変釜銆 涓,M=A^B,N=A&B 閭d箞涓轰粈涔坅ssign {M,N}=A+
    绛旓細{}灏辨槸鎶婂嚑浣嶆嫾鍦ㄤ竴璧凤紝绗竴寮犲浘涓婅摑鑹茬殑鏄敊璇殑锛岄粦鑹叉槸姝g‘鐨 绗竴棰樺氨鏄妸鐪熷艰〃鐢讳竴涓嬶紝绛旀灏卞嚭鏉ヤ簡
  • Verilog闂 涓轰粈涔堜豢鐪熶細鍑虹幇xxxx绾㈢嚎 鎬庝箞鎵嶈兘璧嬪垵鍊?
    绛旓細浣犲ソ锛屽嚭鐜扮孩绾挎槸鍥犱负娌℃湁鍒濆鍊笺備竴鑸潵璇存暟瀛楅昏緫鐢佃矾閮芥槸閫氳繃澶嶄綅淇″彿鏉ュ垵濮嬪寲鐨勩備綘闇瑕佸湪杩欎釜module鐨刬nput澧炲姞涓涓猺st淇″彿锛岀劧鍚庡彲浠ヤ慨鏀归偅涓猘lways @(posedge clk or negedge rst)If rst ==0 begin ...(鍒濆鍖栵級
  • 涓涓verilog灏闂
    绛旓細浼氫骇鐢熶竴涓狶atch瀵筫na淇″彿閿佸瓨锛屽鏋滈兘涓嶆槸灏变繚鎸佸厛鍓嶇姸鎬佷笉鍙樸備綘鐨勪唬鐮佷笌涓嬮潰浠g爜鏁堟灉涓鏍枫俛lways@(posedge clk)begin if(!rst)ena <= 1'b0;else if(fetch)ena <= 1'b1;else ena <= ena;end if涓嶅拰else鐨勮瘽瑕佷骇鐢熼攣瀛樺櫒,case璇彞濡傛灉娌℃湁default鍒嗘敮涔熶細浜х敓閿佸瓨鍣ㄣ傛槸浼氫骇鐢熶袱涓狥F锛...
  • verilog鐨勪竴涓闂
    绛旓細鍏勫紵锛屽湪verilog璇硶閲屾湁涓ょ璇彞妯″潡锛氫竴绉嶆槸always鍧 锛屽彟澶栦竴绉嶆槸assign鍧 鏃犺浣犲啓浠涔 锛屽闇瑕佸啓鍦ㄨ繖涓袱涓潡閲屻傚惁鍒欐槸涓嶈鎵胯鐨勶紝鏄病鏈夆滃悕鍒嗏濈殑銆傛墍浠ヤ綘鐨勪唬鐮侊紝鎴戝府浣犱慨鏀逛簡涓涓嬶紝甯屾湜瀵逛綘鏈夊府鍔 module case_1(set,choose,data_out,data_in);output data_out;input set;input ...
  • verilog璇█绋嬪簭闂?
    绛旓細閭d釜鏄姞鍑忔硶鐨勭粨鏋滃嚭鐜颁簡婧㈠嚭锛屽彇鍙嶅姞1锛屼竴鑸兘鏄璐熸暟鍙樻垚姝f暟鐨勬搷浣溿傝繖涓湴鏂归鍏堝垽鏂璪it15鏄笉鏄紝濡傛灉鏄0锛屽啀鍒ゆ柇bit14锛屽鏋渂it14涓1锛屽氨鍋氫竴涓彇鍙嶅姞1锛屼粠璐熸暟鍙樻垚姝f暟銆
  • verilog鐨勭浉鍏闂
    绛旓細1:verilog閲屽彲浠 VHDL閲屼笉鍙互 2://鍗曡娉ㄨВ /*...*/澶氳娉ㄨВ 3:渚嬪[3:0]琛ㄧず4浣嶅 [5:1]琛ㄧず5浣嶅 4'd10琛ㄧず4浣嶅崄杩涘埗鏁,涓烘暟涓嶅宸︾琛0 4'b0101琛ㄧず4浣2杩涘埗 鍏朵粬杩涘埗绫讳技 4:鍛...涓嶇煡閬...5:缂栬瘧鎸囧鏄暐,璨屼技褰撳垵鎴戞病瀛﹀埌...鍙檽寰楃紪璇..涓嶇煡缂栬瘧鎸囧...6:褰撶劧鍟,瓒...
  • Verilog鏈夊叧鐨勪竴涓闂
    绛旓細浣犵殑鎰忔濇槸杩欏洓绉嶈繍绠楅兘鏄瓙妯″潡瀵瑰悧锛熺幇鍦ㄦ湁涓ょ鏂规锛1銆佷綘鍙互淇敼瀛愭ā鍧楋紝鍚勬坊鍔犱竴涓墖閫変俊鍙枫傚洓涓瓙妯″潡鐨勮緭鍏ヨ緭鍑洪兘杩炲埌椤跺眰妯″潡鐨勮緭鍏ヨ緭鍑轰笂锛屽啀澧炲姞涓涓牴鎹墖閫変俊鍙烽夋嫨杈撳叆杈撳嚭鎺ュ埌鍝釜瀛愭ā鍧楃殑鐗囬夐昏緫 2銆佷笉淇敼瀛愭ā鍧楋紝鍥涗釜瀛愭ā鍧楃殑杈撳叆閮借繛鍒伴《灞傜殑杈撳叆锛屽湪浣犵殑if-else閫昏緫閲屽鍔犲鍥...
  • 扩展阅读:verilog assign ... verilog hdl ... verilog always ... verilog module ... verilog菜鸟教程 ... verilog发音 ... verilog语法大全 ... verilog经典案例 ... 状态机verilog ...

    本站交流只代表网友个人观点,与本站立场无关
    欢迎反馈与建议,请联系电邮
    2024© 车视网