phù hợp với: trong std_logic; loadnum1 loadnum2, loadnum3, loadnum4, loadnum5, loadnum6, mẫu: ra std_logic; seldisplay: ra khỏi phạm vi tự nhiên 0 đến 5, numled: std_logic_vector ra (1-6)); cuối lottcont2 thực thể, kiến trúc fsm2 của lottcont2 loại lott_state_type | Examples of VHDL Descriptions ----1---1 end process end architecture v1 Controller --controller for lottery number generator --new version uses 6 number registers and --compares all numbers simulateously library ieee use entity lottcont2 is port clock reset next_no match in std_logic loadnuml loadnum2 loadnum3 loadnum4 loadnum5 loadnum6 sample out std_logic seldisplay out natural range 0 to 5 numled out std_logic_vector 1 to 6 end entity lottcont2 architecture fsm2 of lottcont2 is type lott_state_type is res s1 s2 s3 s4 s5 s6 s7 1 1 1 1 1 1s8 s9 s10 s11 s12 s13 s14 s15 s16 s17 s18 1 1 1 1 . 1 s19 s2 0 s21 s22 s2 3 s2 4 s25 s2 6 s2 7 s2 8 signal lott_ps lott_ns lott_state_type begin --next state process fsm_state_reg process begin wait until rising_edge clock if reset 1 then lott_ps res else lott_ps lott_ns end if end process fsm_logic process lott_ps next_no match begin --assign default output values loadnum1 0 loadnum2 0 loadnum3 0 loadnum4 0 loadnum5 0 loadnum6 0 sample 0 seldisplay 0 .1 1 1 1 1 Umnumled 111111 case lott_ps is when res --wait for 1st no if next_no 1 then lott_ns s1 else lott_ns res end if when s1 --take first sample sample 1 lott_ns s2 1 1 1 I 1 Illi -I 1 1 I -1 when s2 --save first no __1 1 1loadnum1 1 numled 011111 lott_ns s3 1 . 1 -1 1 1 . -- .-1 when s3 --wait for 2nd no 1 1 11 . 1 1 numled 011111 http aoursewxre adveda vhdl 31 of 67 2 3 1 2002 4 1 5 0 9 Examples of VEIDL Descriptions if next_no 1 then lott_ns s4 else lott_ns s3 end i f when s4 --sample 2nd no numled 011111 sample 1 lott_ns s5 when s5 --check for duplicate numled 011111 if match 1 then lott_ns s4 else lott_ns s6 end i f when s6 --store second number numled 101111 loadnum2 11 lott_ns s7 when s7 --wait for 3rd no numled 101111 seidisplay 1 if next_no 1 then lott_ns s8 else lott_ns s7 end i f when s8 --sample 3rd no numled 101111 seidisplay 1 sample 1 lott_ns s9 when s9 --check against other nos numled