【正文】
RCO=39。 //清零信號 BCD: OUT STD_LOGIC_VECTOR(3 DOWNTO 0)。 else Q=00000000?!維imulation waveform】Simulate successfully achieved the function of adder, but it has some delay and interference. I think it may caused by Race and Hazard.Counter【Function introduction】Set D and Q as the signal variable .D resource from the key board .Q is the internal signal of counter ,it circulates upon D.Once D has been settle ,Q is upcount for D times.When Q run for D times, There’s a OUTPUT pulse through Cd .One circulation end.【Programming】library ieee。when 0110 = binary_low=00000110。 when others = binary_high=00000001。 BCD_high: in bit_vector(3 downto 0)。CARRY)。 END IF。//第一個計數(shù)器計數(shù)值 WHEN 00101000= NUM=1111。 WHEN 01000100= NUM=1001。END ENTITY KEYBOARD。 Every box contains twentyfour bottles, stop count until 18 216。 IF (CLK39。EN2=39。EN3=39?!維imulation waveform】Register【Function introduction】 This register has 4bit input and 8bit output, and a input named “carry” is also add to this register . When carry equal to “1”, put the 4bit input to high output pin, when the other, the 4bit input will be put into low output pin.【programming】LIBRARY IEEE。139。139。【BCD to binary (lowbit)】library IEEE。 end case。 Q:buffer std_logic_vector(7 downto 0)。139。039。 END PROCESS。139?!維imulation waveform】assume EN is HIGH for 3 clock pulse .D is settle as 16.We can get the simulate wave form as below So the counter’s function has been realized.Counter for the sum of tablets【Function introduction】 I use four Asynchronous decimal counter construct a big counter which count range from 0 to moment a pulse which represent a tablets drop down reach, the lease significant counter add one. And when the counter