2021年4月24日 星期六

HBLbits_Verilog Basic_Exams/ece241 2014 q1c

HBLbits_Verilog Basic_Exams/ece241 2014 q1c 

Assume that you have two 8-bit 2's complement numbers, a[7:0] and b[7:0]. These numbers are added to produce s[7:0]. Also compute whether a (signed) overflow has occurred.

module top_module (
    input [7:0] a,
    input [7:0] b,
    output [7:0] s,
    output overflow
); //
    assign s = a + b;
    assign overflow = (a[7] & b[7] & ~s[7]) | (~a[7] & ~b[7] & s[7]);
endmodule

沒有留言:

張貼留言

DISCORD ESP32

DISCORD  ESP32        準備工作:取得 Discord Webhook URL 開啟 Discord 並進入你的伺服器。 進入頻道設定(齒輪圖示) > 整合 (Integrations) > Webhook 。 點擊「建立 Webhook」,設定...