// 死工程師阿宅的黑色幽默… 看不懂火星文是正常的...
// 何時 CONST 才會變成晚上小一點的時間變數呢 ?
module baby_hungry_model;
wire baby_crying, feed;
wire real feed_volumn;
alan alan_inst ( baby_crying, feed, feed_volumn );
baby baby_inst ( feed, baby_crying, feed_volumn )
endmodule
module alan( baby_crying, feed, feed_volumn );
input baby_crying;
output feed;
output real feed_volumn;
always@(posedge baby_crying ) begin
feed <= 1'b1;
feed_volumn <= full_baby_stomach;
#1hour;
feed <= 1'b0;
end
endmodule
module baby ( feed, baby_crying, feed_volumn );
input feed;
input real feed_volumn;
output baby_crying;
reg real stomach_fifo;
always@(posedge feed ) begin
#1h;
stomach_fifo <= stomach_fifo + feed_volumn;
end
always begin
#time_tick;
stomach_fifo <= stomach_fifo - "CONST";
end
assign baby_crying = ( stomach_fifo < HUNGRY_WATER_LEVEL )? 1'b1 : 1'b0;
endmodule
留言列表