-
Notifications
You must be signed in to change notification settings - Fork 262
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move width calculation function to separate package
- Loading branch information
Sławomir Siluk
committed
Nov 15, 2020
1 parent
9bbb6d1
commit 1678d0c
Showing
4 changed files
with
35 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
-- This Source Code Form is subject to the terms of the Mozilla Public | ||
-- License, v. 2.0. If a copy of the MPL was not distributed with this file, | ||
-- You can obtain one at http://mozilla.org/MPL/2.0/. | ||
-- | ||
-- Copyright (c) 2014-2020, Lars Asplund lars.anders.asplund@gmail.com | ||
|
||
package helpers_pkg is | ||
function calc_width(d : positive) return natural; | ||
end package; | ||
|
||
package body helpers_pkg is | ||
function calc_width(d : positive) return natural is | ||
variable i : natural; | ||
variable v : natural := d-1; | ||
begin | ||
while v > 0 loop | ||
v := v/2; | ||
i := i + 1; | ||
end loop; | ||
return i; | ||
end; | ||
end package body; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters