Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- part of a SEM_DRIVER module of a DATA PATH module
- -- priority routing
- -- when in PASSIVE mode, turn on all YELLOW lights
- if pi_active_mode = '0' then
- po_semaphore_ctrl_east <= "010";
- po_semaphore_ctrl_west <= "010";
- po_semaphore_ctrl_south <= "010";
- po_semaphore_ctrl_north <= "010";
- else
- case sem_phase_sel is
- -- active direction (EW_GO or SN_GO state active)
- -- sees RED lights at this phase
- when "01" =>
- -- active_dir_s is an external signalization, an input of FSM
- -- this signal tells which crossroad direction executes its sequence next.
- -- '0' --> next_state <= SN_GO,
- -- south/north semaphores start their sequence: RED, YELLOW, GREEN, YELLOW
- -- '1' --> next_state <= EW_GO
- -- east/west semaphores start their sequence: RED, YELLOW, GREEN, YELLOW
- -- driver: cycle_end
- case active_dir_s is
- when '0' => -- south/north direction sequence
- -- SN_GO.sem_phase: RED,
- -- south/north are RED
- po_semaphore_ctrl_south <= "100";
- po_semaphore_ctrl_north <= "100";
- -- east/west are GREEN
- po_semaphore_ctrl_east <= "001";
- po_semaphore_ctrl_west <= "001";
- when '1' => -- east/west direction sequence
- -- south/north are GREEN
- po_semaphore_ctrl_south <= "001";
- po_semaphore_ctrl_north <= "001";
- -- east/west are RED
- po_semaphore_ctrl_east <= "100";
- po_semaphore_ctrl_west <= "100";
- end case;
- -- active direction sees GREEN light now
- when "11" =>
- case active_dir_s is
- when '0' => -- south/north direction sequence
- -- SN_GO.sem_phase: GREEN,
- -- south/north are GREEN
- po_semaphore_ctrl_south <= "001";
- po_semaphore_ctrl_north <= "001";
- -- east/west are RED
- po_semaphore_ctrl_east <= "100";
- po_semaphore_ctrl_west <= "100";
- when '1' => -- east/west direction sequence
- -- south/north are RED
- po_semaphore_ctrl_south <= "100";
- po_semaphore_ctrl_north <= "100";
- -- east/west are GREEN
- po_semaphore_ctrl_east <= "001";
- po_semaphore_ctrl_west <= "001";
- end case;
- -- NOTE: its not possible to turn on RED and YELLOW at the same time
- -- because colors are one-hot coded.
- -- "00" and "10" will result in all ligths yellow!
- -- "10" --> prepare state of semaphore, this is YELLOW by function
- -- "00" --> unexpected value, we need to cover all cases. Never gonna happen!
- when others =>
- po_semaphore_ctrl_east <= "010";
- po_semaphore_ctrl_west <= "010";
- po_semaphore_ctrl_south <= "010";
- po_semaphore_ctrl_north <= "010";
- end case;
- end if;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement