【正文】
signal temp:std_logic_vector(2 downto 0)。begin process(clk) begin if clk 39。event and clk=39。139。 then if temp=111 then temp=000。 else temp=temp+1。 end if。 end if。 end process。 q=temp。end behv。程序6:library IEEE。use 。use 。use 。entity rsSedn is PORT(clk:in std_logic。 reset:in std_logic。 復(fù)位 datain:in std_logic_vector(7 downto 0)。 發(fā)送十六進(jìn)制代碼 TxD:out std_logic)。 發(fā)送端end rsSedn。architecture Behav of rsSedn is signal TReg:Std_Logic_Vector(7 downto 0)。 發(fā)送寄存器 signal SampleCnt:std_logic_vector(0 to 1)。 從0到3每位計(jì)數(shù)begin TReg=datain。 Rx Process RxProc:process(clk,reset) variable BitPos:INTEGER range 0 to 9。 發(fā)送寄存器的位置 begin if reset=39。039。 then BitPos:=0。SampleCnt=00。 elsif Rising_Edge(clk) then if reset=39。139。 then 復(fù)位 if SampleCnt=11 then SampleCnt=00。 else SampleCnt=SampleCnt+1。 從0到3每位計(jì)數(shù) end if。 case BitPos is when 0= if SampleCnt=01 then 起始位 TxD=39。039。 發(fā)送起始位 Bitpos:=BitPos+1。 發(fā)送寄存器置1 end if。 when 1= if SampleCnt=01 then TxD=Treg(0)。 發(fā)送第1位 BitPos:=BitPos+1。 發(fā)送寄存器置2 end if。 when 2= if SampleCnt=01 then TxD=Treg(1)。 發(fā)送第2位 BitPos:=BitPos+1。 發(fā)送寄存器置3 end if。 when 3= if SampleCnt=01 then TxD=Treg(2)。 發(fā)送第3位 BitPos:=BitPos+1。 發(fā)送寄存器置4 end if。 when 4= if SampleCnt=01 then TxD=Treg(3)。 發(fā)送第4位 BitPos:=BitPos+1。 發(fā)送寄存器置5 end if。 when 5= if SampleCnt=01 then TxD=Treg(4)。 發(fā)送第5位 BitPos:=BitPos+1。 發(fā)送寄存器置6 end if。 when 6= if SampleCnt=01 then TxD=Treg(5)。 發(fā)送第6位 BitPos:=BitPos+1。 發(fā)送寄存器置7 end if。 when 7= if SampleCnt=01 then TxD=Treg(6)。 發(fā)送第7位 BitPos:=BitPos+1。 發(fā)送寄存器置8 end if。 when 8= if SampleCnt=01 then TxD=Treg(7)。 發(fā)送第8位 BitPos:=BitPos+1。 發(fā)送寄存器置9 end if。 when 9= if SampleCnt=01 then TxD=39。139。 發(fā)送第9位 BitPos:=0。 發(fā)送寄存器置0 end if。 end case。 else TxD=39。139。 BitPos:=0。 SampleCnt=00。 end if。 end if。 end process。end Behav。課程設(shè)計(jì)成績(jī)?cè)u(píng)定表成績(jī)?cè)u(píng)定項(xiàng) 目比例得 分平時(shí)成績(jī)(百分制記分)30%業(yè)務(wù)考核成績(jī)(百分制記分)70%總評(píng)成績(jī)(百分制記分)100%評(píng)定等級(jí)優(yōu) 良 中 及格 不及格指導(dǎo)教師(簽名):20 年 月 日 1