【正文】
ess。 end behv。 程序 5: library ieee。 use 。 use 。 entity t8 is port(clk:in std_logic。 q:out std_logic_vector(2 downto 0))。 end t8。 architecture behv of t8 is 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ā)送十六進制代碼 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 每位計數(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每位計數(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è)計成績評定表 成 績 評 定 項 目 比例 得 分 平時成績(百分制記分) 30% 業(yè)務(wù)考核成績(百分制記分) 70% 總評成績(百分制記分) 100% 評定等級 優(yōu) 良 中 及格 不及格 指導(dǎo)教師(簽名): 20 年 月 日 1