Advertisement
milanmetal

SEM_DRIVER

Jul 17th, 2019
440
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
VHDL 2.86 KB | None | 0 0
  1. -- part of a SEM_DRIVER module of a DATA PATH module
  2.  
  3. -- priority routing
  4. -- when in PASSIVE mode, turn on all YELLOW lights
  5. if pi_active_mode = '0' then
  6.   po_semaphore_ctrl_east  <= "010";
  7.   po_semaphore_ctrl_west  <= "010";
  8.   po_semaphore_ctrl_south <= "010";
  9.   po_semaphore_ctrl_north <= "010";
  10. else
  11.   case sem_phase_sel is
  12.     -- active direction (EW_GO or SN_GO state active)
  13.     -- sees RED lights at this phase
  14.     when "01" =>
  15.       -- active_dir_s is an external signalization, an input of FSM
  16.       -- this signal tells which crossroad direction executes its sequence next.
  17.  
  18.       -- '0' --> next_state <= SN_GO,
  19.       -- south/north semaphores start their sequence: RED, YELLOW, GREEN, YELLOW
  20.  
  21.       -- '1' --> next_state <= EW_GO
  22.       -- east/west semaphores start their sequence: RED, YELLOW, GREEN, YELLOW
  23.  
  24.       -- driver: cycle_end
  25.       case active_dir_s is
  26.         when '0' =>                     -- south/north direction sequence
  27.           -- SN_GO.sem_phase: RED,
  28.           -- south/north are RED
  29.           po_semaphore_ctrl_south <= "100";
  30.           po_semaphore_ctrl_north <= "100";
  31.           -- east/west are GREEN
  32.           po_semaphore_ctrl_east  <= "001";
  33.           po_semaphore_ctrl_west  <= "001";
  34.         when '1' =>                     -- east/west direction sequence
  35.           -- south/north are GREEN
  36.           po_semaphore_ctrl_south <= "001";
  37.           po_semaphore_ctrl_north <= "001";
  38.           -- east/west are RED
  39.           po_semaphore_ctrl_east  <= "100";
  40.           po_semaphore_ctrl_west  <= "100";
  41.       end case;
  42.     -- active direction sees GREEN light now
  43.     when "11" =>
  44.       case active_dir_s is
  45.         when '0' =>                     -- south/north direction sequence
  46.           -- SN_GO.sem_phase: GREEN,
  47.           -- south/north are GREEN
  48.           po_semaphore_ctrl_south <= "001";
  49.           po_semaphore_ctrl_north <= "001";
  50.           -- east/west are RED
  51.           po_semaphore_ctrl_east  <= "100";
  52.           po_semaphore_ctrl_west  <= "100";
  53.         when '1' =>                     -- east/west direction sequence
  54.           -- south/north are RED
  55.           po_semaphore_ctrl_south <= "100";
  56.           po_semaphore_ctrl_north <= "100";
  57.           -- east/west are GREEN
  58.           po_semaphore_ctrl_east  <= "001";
  59.           po_semaphore_ctrl_west  <= "001";
  60.       end case;
  61.       -- NOTE: its not possible to turn on RED and YELLOW at the same time
  62.       -- because colors are one-hot coded.
  63.  
  64.     -- "00" and "10" will result in all ligths yellow!
  65.     -- "10" --> prepare state of semaphore, this is YELLOW by function
  66.     -- "00" --> unexpected value, we need to cover all cases. Never gonna happen!
  67.     when others =>
  68.       po_semaphore_ctrl_east  <= "010";
  69.       po_semaphore_ctrl_west  <= "010";
  70.       po_semaphore_ctrl_south <= "010";
  71.       po_semaphore_ctrl_north <= "010";
  72.   end case;
  73. end if;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement