久久国产成人av_抖音国产毛片_a片网站免费观看_A片无码播放手机在线观看,色五月在线观看,亚洲精品m在线观看,女人自慰的免费网址,悠悠在线观看精品视频,一级日本片免费的,亚洲精品久,国产精品成人久久久久久久

分享

Verilog常見(jiàn)必備面試題

 goandlove 2017-01-19

1,、Use verilog hdl to implement a flip-flop with synchronous RESET and SET, a Flip-flop with asynchronous RESET and SET.

always@(posedge clk or negedge reset or posedge set)

begin

if(set)

Q<>

else if(!reset)

Q<>

else

Q<>

end

always@(posedge clk)

begin

if(set)

Q<>

else if(!reset)

Q<>

else

Q<>

end

異步reset和set

同步reset和set


2,、Use verilog hdl to implement a latch with asynchronous RESET and SET.

always @(clk or reset or set)

begin

if(set)

Q=1;

else if(!reset)

Q=0;

else

Q=D;

end


3、Use Verilog hdl to implement a 2-to-1multiplexer.

assign Y=(SEL==1'b0)?A:B;


4,、Use AND gate, OR gate and Inverter toimplement a 2-to-1 multiplexer.

module MUX21(A, B, SEL, Y);

input A,B,SEL;

output Y;

net SEL_NOT, A_AND, B_AND;

not u0(SEL_NOT, SEL);

and u1(A_AND, SEL_NOT, A);

and u2(B_AND, SEL, B);

or u3(Y, A_AND, B_AND);

endmodule


5,、Use a 2-to-1 multiplexer to implement a two input OR gate.

module or2(A, B, Y);

input A, B;

output Y;

MUX21 u0(Y, A, B, B );

endmodule

module MUX21(Y, A ,B, SEL)

input A,B,SEL;

output Y;

assign Y=(SEL==1’b0):A:B;

endmodule

assign Y=A?A:B;


6、Use a tri-state buffer to implement Open-Drain buffer.

assign Y=EN?DataIn:1'bz;


7,、To divide one input clock by3, Written by verilog hdl.

module clk_div_3(clk, reset, clk_out);

input reset,clk;

output clk_out;

reg clk_out;

reg [1:0] cnt;

always@(posedge clk or negedge reset)

begin

if(!reset)

begin cnt<>

clk_out<>

else if(cnt==2'b01) begin clk_out<>

cnt<=cnt+1'b1;>

else if(cnt==2'b10) begin clk_out<>

cnt<>

else cnt<>

end

endmodule


,, 占空比1/3


8、To divide one input clock by3, 50% dutycycle is required. Written by verilog hdl.

module clk_div_3(clk, reset, clk_out);

input reset,clk;

output clk_out;

reg clk_out1, clk_out2;

reg [1:0] cnt1,cnt2;

assign clk_out = clk_out1 | clk_out2;

always@(posedge clk or negedge reset)

begin

if(!reset)

begin cnt1<>

clk_out1<>

else if(cnt1==2'b01) begin clk_out1<>

cnt1<=cnt1+1'b1;>

else if(cnt1==2'b10) begin clk_out1<>

cnt1<>

else cnt1<>

end

always@(negedge clk or negedge reset)

begin

if(!reset)

begin cnt2<>

clk_out2<>

else if(cnt2==2'b01) begin clk_out2<>

cnt2<=cnt2+1'b1;>

else if(cnt2==2'b10) begin clk_out2<>

cnt2<>

else cnt2<>

end

endmodule

module clk_div_3(clk, reset, clk_out);

input reset,clk;

output clk_out;

reg [1:0] cnt;

reg clk_out1, clk_out2;

always@(posedge clk)

begin

if(!reset)

cnt<>

else if(cnt=='d2)

cnt<>

else

cnt<>

end

always @(posedge clk or negedge reset)

begin

if(!reset)

clk_out1<>

else if(cnt=='d2)

clk_out1<>

else if(cnt == 'd1)

clk_out1<>

end

always @(negedge clk or negedge reset)

begin

if(!reset)

clk_out2<>

else if(cnt=='d2)

clk_out2<>

else if(cnt == 'd1)

clk_out2<>

end

assign clk_out = clk_out1 | clk_out2;

endmodule


(來(lái)源:EDN電子技術(shù)設(shè)計(jì))

    本站是提供個(gè)人知識(shí)管理的網(wǎng)絡(luò)存儲(chǔ)空間,,所有內(nèi)容均由用戶(hù)發(fā)布,,不代表本站觀點(diǎn),。請(qǐng)注意甄別內(nèi)容中的聯(lián)系方式、誘導(dǎo)購(gòu)買(mǎi)等信息,,謹(jǐn)防詐騙,。如發(fā)現(xiàn)有害或侵權(quán)內(nèi)容,請(qǐng)點(diǎn)擊一鍵舉報(bào),。
    轉(zhuǎn)藏 分享 獻(xiàn)花(0

    0條評(píng)論

    發(fā)表

    請(qǐng)遵守用戶(hù) 評(píng)論公約

    類(lèi)似文章 更多