|
|
|
|
|
by scott_wilson46
4161 days ago
|
|
I can't help but feel that the VHDL that was written is a bit overly verbose. You could probably write something like: i_sm: process(clk, reset)
begin
if (reset) then
state <= DATA_BITS;
elsif (clk'event and clk = '1') then
case (state)
when DATA_BITS =>
if (data_valid = '1') then
if (count < 8) then
count <= count + 1;
else
state <= STOP_BIT;
count <= 0;
end if;
end if;
when STOP_BITS =>
if (data_valid = '1') then
if (count < num_stop_bits) then
count <= count + 1;
else
state <= DATA_BITS;
count <= 0;
end if;
end if;
end case
end if;
end process i_sm;
which is not too dis-similar from the Cx example (I've missed a few things out like port/signal declerations, just wanted to show the guts of the code). The thing I like about VHDL/Verilog is that its easy to tell the exact port names, what the clk is, the name and type of reset, etc which is useful information for putting the block in the context of an overall system. |
|
And I also agree on your point. This is why we added properties to the language (http://cx-lang.org/documentation/properties) so one can either use the (implicit) default names and types for the clk, reset, etc. or explicit/tweek things for more complex systems.