Forum Discussion
Altera_Forum
Honored Contributor
14 years agoLOC Program for VHDL
Hey Guys. I've been asked to count the number of lines of code (LOC) for VHDL. I need to count the physicial lines of code, logical lines of code, and also the number of commented lines. Anyone...
Altera_Forum
Honored Contributor
14 years ago --- Quote Start --- I've been asked to count the number of lines of code (LOC) for VHDL. I need to count the physicial lines of code, logical lines of code, and also the number of commented lines. Anyone have any ideas on an algorithm I can use for this? --- Quote End --- There is likely a unix tool that already does most of this, eg. awk or sed. Alternatively write a Perl/Tcl/bash script that parses a file a line at a time, and decides whether the line is a comment, space, or code. However, distinguishing the lines of VHDL code as being logical might be a little difficult or meaningless, since the following line of code:
c <= a and b;
can also be written as
process(a,b)
begin
if ((a = '1') and (b = '1')) then
c <= '1';
else
c <= '0';
end if;
end process;
Ideally you should 'count' the second form as one line of 'logical' code right? Cheers, Dave