3
0
Fork 0
mirror of https://github.com/YosysHQ/sby.git synced 2025-04-12 16:28:17 +00:00

Update wolf_goat_cabbage.sv

Signed-off-by: Claire Wolf <claire@symbioticeda.com>
This commit is contained in:
Claire Wolf 2020-04-22 19:21:15 +02:00
parent 3c14d12180
commit b26d4e6362

View file

@ -10,10 +10,10 @@ module wolf_goat_cabbage (input clk, input w, g, c);
reg bank_w = 0; // wolf reg bank_w = 0; // wolf
reg bank_g = 0; // goat reg bank_g = 0; // goat
reg bank_c = 0; // cabbage reg bank_c = 0; // cabbage
reg bank_p = 0; // person who drives the boat reg bank_p = 0; // person
always @(posedge clk) begin always @(posedge clk) begin
// person travels and takes the selected item with him // person travels and takes the selected item with them
bank_p <= !bank_p; bank_p <= !bank_p;
if (w && (bank_w == bank_p)) bank_w <= !bank_p; if (w && (bank_w == bank_p)) bank_w <= !bank_p;
if (g && (bank_g == bank_p)) bank_g <= !bank_p; if (g && (bank_g == bank_p)) bank_g <= !bank_p;