Featured post

Top 5 books to refer for a VHDL beginner

VHDL (VHSIC-HDL, Very High-Speed Integrated Circuit Hardware Description Language) is a hardware description language used in electronic des...

Sunday, 25 January 2015

SystemVerilog Strings

String data type is used for storing strings, the size is dynamic and string data types come with build in methods. If you have ever tried to use a Verilog reg variable to hold a string of characters, your suffering is over with this post. The SystemVerilog string type holds variable-length strings. String literals are packed arrays of a width that is a multiple of 8 bits which hold ASCII values i.e. an individual character is of type byte. The elements of a string of length N are numbered 0 to N-1. Note that, unlike C, there is no null character at the end of a string, and any attempt to use the character “\0” is ignored.


string StringName = "VLSI Encyclopedia";

Strings use dynamic memory allocation, so you do not have to worry about running out of space to store the string. Example 1 shows various string operations.

Below is the list of string methods :
  • str.len() returns the length of the string, i.e., the number of characters in the string. 
  • str.putc(i, c) replaces the ith character in str with the given integral value. 
  • str.getc(i) returns the ASCII code of the ith character in str. 
  • str.toupper() returns a string with characters in str converted to uppercase. 
  • str.tolower() returns a string with characters in str converted to lowercase. 
  • str.compare(s) compares str and s, and return value. This comparison is case sensitive. 
  • str.icompare(s) compares str and s, and return value .This comparison is case insensitive. 
  • str.substr(i, j) returns a new string that is a substring formed by index i through j of str. 
  • str.atoi() returns the integer corresponding to the ASCII decimal representation in str. 
  • str.atoreal() returns the real number corresponding to the ASCII decimal representation in str. 
  • str.itoa(i) stores the ASCII decimal representation of i into str (inverse of atoi). 
  • str.hextoa(i) stores the ASCII hexadecimal representation of i into str (inverse of atohex). 
  • str.bintoa(i) stores the ASCII binary representation of i into str (inverse of atobin). 
  • str.realtoa(r) stores the ASCII real representation of r into str (inverse of atoreal)

Example 1: SystemVerilog String Methods


// SystemVerilog Strings
module str; 
  string S1; 
  string S2; 
  initial begin 
    S1 = "VLSI "; 
    S2 = "Encyclopedia"; 
    $display(" %d ",S1.len() ); 
    $display(" %s ",S2.getc(5) ); 
    $display(" %s ",S1.tolower); 
    $display(" %s ",S2.toupper); 
    $display(" %d ",S2.compare(S1) ); 
    $display(" %d ",S1.compare("VLSI") ); 
    $display(" %s ",S1.substr(2,3) ); S1 = "111"; 
    $display(" %d ",S1.atoi() ); 
  end 
endmodule 

Simulation Result :

 5
 l
 vlsi
 ENCYCLOPEDIA
 -17
 1
 SI
 111

Pattern Matching of SystemVerilog Strings
In below example we have used a method to match the strings in SystemVerilog.

Example 2 : Pattern matching


// SystemVerilog String Pattern Matching
 
program main; 
  string S1,S2; 
  initial begin 
    S1 = "String matching in SystemVerilog"; 
    S2 = "String"; 
    if(match(S1,S2)) 
      $display(" S2 : %s : found in :%s:",S2,S1); 

    S2 = "SystemVerilog"; 
    if(match(S1,S2)) 
      $display(" S2 : %s : found in :%s:",S2,S1); 

    S2 = "String matching"; 
    if(match(S1,S2)) 
      $display(" S2 : %s : found in :%s:",S2,S1); 

    S2 = "matching in "; 
    if(match(S1,S2)) 
      $display(" S2 : %s : found in :%s:",S2,S1); 

    S2 = "String matching in SystemVerilog"; 
    if(match(S1,S2)) 
      $display(" S2 : %s : found in :%s:",S2,S1); 
  end 
endprogram

function match(string s1,s2); 
  int len1,len2; 
  len1 = s1.len(); 
  len2 = s2.len(); 
  match = 0 ; 
  if( len2 > len1 ) 
    return 0; 
  for(int i = 0;i < len1 - len2 + 1; i ++) 
    if( s1.substr(i,i+len2 -1) == s2) 
  return 1; 
endfunction

Simulation Results:
 S2 : String : found in :String matching in SystemVerilog:
 S2 : SystemVerilog : found in :String matching in SystemVerilog:
 S2 : String matching : found in :String matching in SystemVerilog:
 S2 : matching in  : found in :String matching in SystemVerilog:
 S2 : String matching in SystemVerilog : found in :String matching in SystemVerilog:

SystemVerilog operations
There are variety of operations associated with SystemVerilog strings that you can perform to manipulate the  combination of string variables and string literals. Below are the basic operation that can be performed on strings.

1. Checking equality of two strings : S1 == S2
Checks whether the two strings are equal. Checking equality results 1 if they are equal and 0 if they are unequal. Both strings can be of type string. Or one of them can be a string literal. If both operands are string literals, the operator is the same Verilog equality operator as for integer types.

Example 3 : Checking Equality

// SystemVerilog Strings Equality
module str; 
  string S1 = "VLSI Encyclopedia"; 
  string S2 = "VLSI Encyclopedia";
  string S3 = "vlsi encyclopedia";
  initial begin 
    if(S1 == S2) 
      $display(" S1 and S2 are equal"); 
    else 
      $display(" S1 and S2 are not equal"); 
    if(S1 == S3) 
      $display(" S1 and S3 are equal"); 
    else 
      $display(" S1 and S3 are not equal"); 
  end 
endmodule 

Simulation Results 
S1 and S2 are equal
S1 and S3 are not equal

2. Checking equality of two strings : S1 != S2
Reverse to the equality operation this operation results 0 if two strings are equal and 1 if they are unequal.

Example 4: Checking Inequality

// SystemVerilog Strings Equality
module str; 
  string S1 = "VLSI Encyclopedia"; 
  string S2 = "VLSI Encyclopedia";
  string S3 = "vlsi encyclopedia";
  initial begin 
    if(S1 != S2) 
      $display(" S1 and S2 are not equal"); 
    else 
      $display(" S1 and S2 are equal"); 
    if(S1 != S3) 
      $display(" S1 and S3 are not equal"); 
    else 
      $display(" S1 and S3 are equal"); 
  end 
endmodule 

Simulation Results 
S1 and S2 are equal
S1 and S3 are not equal

3. Concatenation of strings : {S1, S2, S3,...,Sn}
To concatenate two or more strings, specify the string variable inside {} each separated by comma",". Each operand can be of type string or a string literal.

Example 5 : Concatenation


// SystemVerilog Strings Concatenation
module str; 
  string S1, S2, S3, S4, S5; 
  initial begin 
    S1 = "Con"; 
    S2 = "cate"; 
    S3 = ""; 
    S4 = "na"; 
    S5 = "tion"; 
    $display(" %s ",{S1,S2,S3,S4,S5}); 
  end 
endmodule 

Simulation Results
Concatenation

4. Replication of Strings : {N{S1}}
The result of replication is a string containing N concatenated copies of S1. N is the multiplier ans S1 can be of string type or string literal.

Example 6 : Replication

// SystemVerilog Strings Replication
module str; 
  string S1, S2; 
  initial begin 
    S1 = "w"; 
    S2 = ".vlsiencyclopedia.com"; 
    $display(" %s ",{{3{S1}},S2}); 
  end 
endmodule 

Simulation Results :
www.vlsiencyclopedia.com

5. String Indexing : S1[Index]
It returns a byte, an ASCII code at the given Index. Index can range from 0 to N where N is the number of characters in the string. If the Index is out of range then result will be 0.

Example 7 : Indexing

// SystemVerilog Strings Indexing
module str; 
  initial begin
    string S1; 
   S1 = "Indexing"; 
  for(int i =0 ;i < 8 ; i++) 
    $display("%s ",S1[i]); 
  end 
endmodule 

Simulation Result :
I
n
d
e
x
i
n
g

Previous : SystemVerilog Constants
Next : Net Type

Saturday, 24 January 2015

SystemVerilog Constants

In previous post of this SystemVerilog Tutorial we talked about enumerated type in detail. Now we will look at the constants in SystemVerilog. There are several types of constants in systemVerilog. The classic Verilog way to create a constant is with a text macro. 

On the plus side, macros have global scope and can be used for bit field definitions and type definitions.
On the negative side, macros are global, so they can cause conflicts if you just need a local constant. 
Lastly, a macro requires the ` character so that it will be recognized and expanded.

In SystemVerilog, parameters can be declared at the $root level so they can be global. This approach can replace many Verilog macros that were just being used as constants. You can use a typedef to replace those large macros. The next choice is a parameter. A Verilog parameter was loosely typed and was limited in scope to a single module. Verilog-2001 added typed parameters, but the limited scope kept parameters from being widely used.

SystemVerilog allows you to declare constant identifiers. You can declare an identifier as constant by prefixing the usual identifier definition with the keyword const. At the time of defining a constant, the user needs to provide a value for the identifier. At any later stage in the code, a SystemVerilog compiler disallows any modification to the value bound to the identifier.


// Constant bit 
const bit [63:0] data_bus='hB6AB31E0;
// Constant int bus width
const int bus_width = 8;
// Constant String VLSI Encyclopedia
const string name = "VLSI Encyclopedia";
// Constant method
function int count (const ref bytes[]);

In addition to a normal identifier declaration, the const modifier can be used to declare function/task arguments as constants. An argument to a function may be of either a pass-by-value or pass-by-reference type. When using pass-by-value semantics, the const modifier has the usual meaning; the locally bound parameter's value can not be changed in the given function.

When using pass-by-reference semantic (as is the case with const ref arrays), the SV compiler ensures that the referenced value is not modified by the code in the function. Normally arrays (even dynamic ones) are passed by value. 

Since arrays could be very big, SystemVerilog allows you to declare an array parameter type as a reference, by prefixing the function parameter with keyword ref. But this introduces the danger of a user inadvertently altering the arrays (actually it's elements) value. By prefix const to the reference array parameter, you can avoid this danger. The compiler would ensure that inside the function, a user can not alter the arrays value.

Note :
Constant identifiers in SystemVerilog are not compile time constants. As a result it is not allowed to use a constant as a range parameter for an array. This is much unlike C++, wherein constants are compile time constants. As an alternative, SystemVerilog users are allowed to use parameters (aka parameterized functions and classes) as range specifiers for an array.

Previous : SystemVerilog Enumerated Types
Next : SystemVerilog Strings

Friday, 23 January 2015

SystemVerilog Enumerated Types

An enumeration creates a strong variable type that is limited to a set of specified names such as the instruction opcodes or state machine values. Using these names, such as ADD, MOVE, or STATE, makes your code easier to write and maintain than using literals such as 8’h01.

The simplest enumerated type declaration contains a list of constant names and one or more variables. This creates an anonymous enumerated type.

Example 1:
A simple enumerated type

enum {RED, BLUE, GREEN} color;

You usually want to create a named enumerated type to easily declare multiple variables, especially if these are used as routine arguments or module ports. You first create the enumerated type, and then the variables of this type.

You can get the string representation of an enumerated variable with the function name().

Example 2: Enumerated Type

module enum_method; 
  typedef enum {RED,BLUE,GREEN} colour; 
  colour c; 
  initial begin 
    c = c.first(); 
    $display(" %s ",c.name); 
    c = c.next(); 
    $display(" %s ",c.name); 
    c = c.last(); 
    $display(" %s ",c.name); 
    c = c.prev(); 
    $display(" %s ",c.name); 
  end 
endmodule 

Output :
RED
BLUE
GREEN
BLUE


Defining enumerated values

The actual values default to integers starting at 0 and then increase. You can choose your own enumerated values. The below line uses the default value of 0 for RED, then 2 for BLUE, and 3 for GREEN.

typedef enum {RED, BLUE=2, GREEN} color_e;

Enumerated constants, such as RED above, follow the same scoping rules as variables. Consequently, if you use the same name in several enumerated types (such as RED in different state machines), they have to be declared in different scopes such as modules, program blocks, routines, or classes.

Enumerated types are stored as int unless you specify otherwise. Be careful when assigning values to enumerated constants, as the default value of an int is 0. In Example 3 below, position is initialized to 0, which is not a legal ordinal_e variable. This behavior is not a tool bug – it is
how the language is specified. So always specify an enumerated constant with the value of 0, just to catch this error.

Example 3 Incorrectly specifying enumerated values

typedef enum {FIRST=1, SECOND, THIRD} ordinal_e;
ordinal_e position;


Example 4 Correctly specifying enumerated values

typedef enum {ERR_O=0, FIRST=1, SECOND, THIRD} ordinal_e;
ordinal_e position;

Enumerated methods : Methods associated with enumerated types

SystemVerilog also includes a set of specialized methods0 associated with enumerated types to enable iterating over the values of enumerated. 

The first() method returns the value of the first member of the enumeration. 

The last() method returns the value of the last member of the enumeration. 

The next() method returns the Nth next enumeration value (default is the next one) starting from the current value of the given variable. 

The prev() method returns the Nth previous enumeration value (default is the previous one) starting from the current value of the given variable. 

The name() method returns the string representation of the given enumeration value. If the given value is not a member of the enumeration, the name() method returns the empty string.

The functions next() and prev() wrap around when they reach the beginning or end of the enumeration.

Note that there is no easy way to write a for loop that steps through all members of an enumerated type if you use an enumerated loop variable. You get the starting member with first() and the next() member with next(). The problem is creating a comparison for the final iteration through the loop. If you use the test current!=current.last, the loop ends before using the last value. If you use current<=current.last, you get an infinite loop, as next never gives you a value that is greater than the final value. You can use a do...while loop to step through all the values.

Converting to and from enumerated types

The default type for an enumerated type is int (2-state). You can take the value of an enumerated variable and put it in an integer or int with a simple assignment. But SystemVerilog does not let you store a 4-state integer in an enum without explicitly changing the type. SystemVerilog requires you to explicitly cast the value to make you realize that you could be writing an out-of-bounds value.

Example 5:  Assignments between integers and enumerated types


module enum_method; 
  typedef enum {RED, BLUE, GREEN} COLOR_E;
  COLOR_E color, c2;
  integer c;
  initial begin
    c = color; // Convert from enum to integer
    c++; // Increment integer
    if (!$cast(color, c)) begin // Cast integer back to enum
      $display("Cast failed for c=%0d", c);
    end
    $display("Color is %0d & %0s", color, color.name);
    c2 = COLOR_E'(c); // No type checking done
  end

endmodule 

Output : 
Color is 1 & BLUE

Run Simulation


In above Example 5, $cast tried to assign from the right value to the left. If the assignment succeeds, $cast returns 1. If the assignment fails because of an out-of-bounds value, no assignment is made and the function returns 0. If you use $cast as a task and the operation fails, SystemVerilog prints an error.

You can also cast the value using the type’(val) as shown above, but this does not do any type checking, so the result may be out of bounds. You should not use this style.

Previous : SystemVerilog Built-in Data Types
Next : SystemVerilog Constants

Thursday, 22 January 2015

SystemVerilog Built-In Data Types

Verilog-1995 has two basic data types: variables (reg) and nets, that hold four-state values: 0, 1, Z, and X. RTL code uses variables to store combinational and sequential values. Variables can be unsigned single or multi-bit (reg [7:0] m), signed 32-bit variables (integer), unsigned 64-bit variables (time), and floating point numbers (real). Variables can be grouped together into arrays that have a fixed size. All storage is static, meaning that all variables are alive for the entire simulation and routines cannot use a stack to hold arguments and local values. A net is used to connect parts of a design such as gate primitives and module instances. Nets come in many flavors, but most designers use scalar and vector wires to connect together the ports of design blocks.

SystemVerilog adds many new data types to help both hardware designers and verification engineers.

The logic type

The one thing in Verilog that always leaves new users scratching their heads is the difference between a reg and a wire. When driving a port, which should you use? How about when you are connecting blocks? System-Verilog improves the classic reg data type so that it can be driven by continuous assignmentsgates and modules, in addition to being a variable. It is given the new name logic so that it does not look like a register declaration. The one limitation is that a logic variable cannot be driven by multiple drivers such as when you are modeling a bidirectional bus. In this case, the variable needs to be a net-type such as wire.

Example: shows the SystemVerilog logic type.
module logic_data_type(input logic rst_h);
  parameter CYCLE = 20;
  logic q, q_l, d, clk, rst_l;

initial begin
  clk <= 0; // Procedural assignment
  forever #(CYCLE/2) clk = ~clk;
end

assign rst_l = ~rst_h; // Continuous assignment
not n1(q_l, q); // q_l is driven by gate
my_dff d1(q, d, clk, rst_l); // d is driven by module

endmodule

Two-state types

SystemVerilog introduces several two-state data types to improve simulator performance and reduce memory usage, over four-state types. The simplest type is the bit, which is always unsigned. There are four signed types: byte, shortint, int, and longint.

shortint i                // 2-state, 16-bit signed
int i                        // 2-state, 32-bit signed
longint i                 // 2-state, 64-bit signed
byte b                    // 2-state, 8-bit signed
bit b;                      // 2-state, single-bit
bit [31:0] b32;       // 2-state, 32-bit unsigned


Tips:
You might be tempted to use types such as byte to replace more verbose declarations such as logic [7:0]. Hardware designers should be careful as these new types are signed variables, so a byte variable can only count up to 127, not Chapter 2: Data Types 29 the 255 you may expect. (It has the range -128 to +127.) You could use byte unsigned, but that is more verbose than just bit [7:0]. Signed variables may cause unexpected results with randomization, as discussed in Chapter 6. Be careful connecting two-state variables to the design under test, especially its outputs. If the hardware tries to drive an X or Z, these values are converted to a two-state value, and your testbench code may never know. Don’t try to remember if they are converted to 0 or 1; instead, always check for propagation of unknown values. Use the $isunknown operator that returns 1 if any bit of the expression is X or Z.

Example: Checking for four-state values

if ($isunknown(iport)
$display("@%0d: 4-state value detected on input port",
$time, iport);

Next : SystemVerilog Enumerated Types

Friday, 9 January 2015

Button-Size Wearable Computer by Intel

button_by_intelIt just got a lot easier to build wearable gadgets that aren’t so bulky or awkward.

Intel CEO Brian Krzanich showed off a minuscule computer, dubbed Curie, during a keynote speech at the International Consumer Electronics Show in Las Vegas on Tuesday. Krzanich plucked a button off his blazer before explaining that it contained a Curie demo module.

Curie is a sure sign that hardware makers are eager to build wearable devices of all kinds. It also points to the unwelcome size of many existing smart watches and smart glasses.

Intel’s new device will include a Bluetooth low-energy radio, motion sensors, and components designed to rapidly and precisely differentiate between different types of physical activity. Krzanich said Curie will run “for extended periods of time” on a coin-size battery and would be available in the second half of the year.

Curie appeared much smaller than a postage-stamp-size computer, called Edison, that Krzanich showed off at last year’s CES.

The world’s largest chip maker evidently sees wearables as one of the most important categories in consumer electronics. It’s a belief held by a lot of other companies at CES, where gadgets meant to be worn on the body or clipped to clothing were all over the show floor this year (see “CES 2015: Wearables Everywhere”).

To make it clear that Curie is already functional, the company built a simple step-tracking smartphone app to go with the module Krzanich had on him; at one point he pulled the phone out of his pocket, and its display indicated he’d taken 1,788 steps during the keynote.

As part of its wearables push, Intel has partnered with a number of companies in the fashion and accessories businesses, including Luxottica Group, which is the world’s largest eyeglass maker with brands such as Ray-Ban and Oakley. Krzanich said Luxottica will use Curie to make “truly consumer-friendly” smart glasses—a notoriously tricky thing to do, in part because of the size of components needed to make them work.

Oakley CEO Colin Baden joined Krzanich on stage to talk about wearables, which Oakley has built in the form of devices like ski goggles that include a head-up display. When you put a wearable device on your face, Baden said, it becomes part of your personality. “It’s important the form factor compress so the electronic component of it doesn’t become burdensome,” he said.

Wednesday, 24 December 2014

OSVVM – Thinking beyond constrained random

osvvm_logo_thumb What is OSVVM?

OSVVM stands for "Open Source VHDL Verification Methodology". OSVVM is a set of VHDL packages, initially developed by Jim Lewis of Synthworks. OSVVM helps you adopt modern constrained random verification techniques using VHDL.

Constraint random verification approach :

In testbenches, we generally want one each of a large set of test cases (transactions and/or sequences). Uniform randomization does not generate one each. Instead it has a significant amount of repetition. In general, uniform randomization takes O(N*LogN) randomizations to generate N unique test cases. As a result, it repeats Log N test cases. Even for small numbers such 64 test cases, constrained random will generate more than 4X more test cases than needed - actual results will vary with the randomization seed. Constrained random comes with this fundamental problem. Randomization is intended to be uniform over time. However constraint random verification has a number of benefits:

  • If you simulate longer, you generate more test vectors.
  • You may find bugs due to unexpected combinations of inputs, or extreme input values. With directed testing, it is all too easy just to test what you expect to happen, rather than trying to test what you don't expect to happen.
  • Once you have developed an automated test, it can still be used for directed testing.

Still what we need is an approach that only requires O(N) randomizations to generate N unique test cases. Generally these approaches are referred to as being Intelligent Testbenches. Indeed there are some tools out there that handle this. However, when we use a tool based approach we end up with a vendor specific solution. This removes one of the major benefits of a programming language based approach - encounter a issue (pricing or functionality) with one vendor and you can easily switch to another.

What we really need is a methodology for Intelligent Testbenches that is based on a standard language and works on numerous vendor tools.

OSVVM :

VHDL's Open Source VHDL Verification Methodology (OSVVM). OSVVM's methodology leverages the functional coverage you must write when you are using any randomization based approach. Intelligent Coverage™, the main randomization methodology for OSVVM, randomly selects a hole in the coverage and passes this to the stimulus generation process. The stimulus generation process uses this information, perhaps refines it using any methodology (directed, algorithmic, constrained random or file based), and then generates one or more transactions to accomplish generate the item that needs covered.

OSVVM can be used in your current VHDL testbench, in part or in whole as needed.  It allows mixing of our signature “Intelligent Coverage” methodology with other verification methodologies, such as directed, algorithmic, file based, and constrained random. Don’t throw out your existing VHDL testbench or testbench models, re-use them.

There is no new language to learn. There are no specialized “OO” approaches – just plain old VHDL entities and architectures. As a result, it is accessible to RTL designers. In fact, it is our goal to make our testbenches readable to verification (testbench), design (RTL), system, and software engineers.

OSVVM works with any VHDL testbench and is particularly effective when coupled with a transaction based testbench. For us, VHDL and OSVVM are the step beyond constrained random and SystemVerilog. Maybe it is time we update VHDL's acronym to mean Verification and Hardware Design Language.

Intelligent Coverage™ Methodology :

Verification starts with a test plan that identifies all items in a design that need to be tested.  OSVVM, like other advanced methodologies, uses functional coverage to observe conditions on interfaces and within the design to validate that the items identified in the test plan have occurred.  As such, functional coverage helps determine when testing is done.

Unlike other methodologies, in OSVVM’s Intelligent Coverage methodology,  functional coverage is the prime directive – it is where we start our process.  Intelligent Coverage is done in the following steps.

  • Write a high fidelity functional coverage (FC) model
  • Randomly select a hole in the functional coverage 
  • Refine the initial randomization with sequential code 
  • Apply the refined sequence (one or more transactions) 
  • Observe Coverage

The key point of Intelligent Coverage is that we randomize using the functional coverage. Then, if necessary, we refine the randomization using sequential code and any sequence generation method, including constrained random, algorithmic, directed, or file reading methods.

OSVVM is a Low Cost Solution :

The packages are free. OSVVM works on regular VHDL simulators (such as Mentor’s ModelSim and Aldec’s Active-HDL) without additional licenses. The only special language support required is VHDL-2002 protected types and VHDL-2008 type integer_vector (for older simulators, we have a work around for this).

To learn more about OSVVM, see:


OSVVM is an open source VHDL library that is free to use (no license fees) and works with any simulator that supports VHDL-2008 (or VHDL-2002 with a little work).
What is currently in the OSVVM library is only the beginning. Over time, I will be releasing our generic scoreboard package, memory modeling package, and others.

Sunday, 30 November 2014

Intel funding to develop printer for blind

subhum-banerjee-and-braille-printerA 13-year-old Indian-origin boy has received a huge investment from Intel for developing a low-cost printer for the blind, making him the youngest tech entrepreneur funded by a venture capital firm.

Shubham Banerjee, CEO of the Braille printer maker Braigo Labs, had closed an early round funding with Intel Capital, the company's venture capital arm, last month to develop a prototype of low-cost Braille printer.

But to attend the event, Banerjee had to take the day off from middle school. That’s because he’s just 13 years old — making him, quite possibly, the youngest recipient of venture capital in Silicon Valley history. (He’s definitely the youngest to receive an investment from Intel Capital.)

“I would like all of us to get together and help the visually impaired, because people have been taking advantage of them for a long time,” Banerjee said. “So I would like that to stop.”

By “taking advantage,” Banerjee is referring to the high price of Braille printers today, usually above $2,000. By contrast, Braigo Labs plans to bring its printer to market for less than $500.

Banerjee has invented a new technology that will facilitate this price cut. Patent applications are still pending, so he wouldn’t divulge any of the details. But the technology could also be used to create a dynamic Braille display — something that shows one line of text at a time by pushing small, physical pixels up and down, and which currently costs $6,500, according to Braigo advisor Henry Wedler, who is blind.

Banerjee also figures that volume production will help keep the price low. Currently, Braille printers cost so much because the demand is low, so current manufacturers need to set a high price in order to recoup their costs.

“The truth is that demand is low in the U.S.,” Banerjee told me. But, he added, if you brought the price low enough there would be huge demand outside the U.S.

Banerjee built the version version of his Lego Braille printer for a science fair. He didn’t know anything about Braille beforehand. In fact, he’d asked his parents how blind people read, he said onstage, and they were too busy to answer. “Go Google it,” he said they told him, so he did.

After learning about Braille, he came up with the idea to make a Braille printer. He showed it at his school’s science fair, then later entered it into the Synopsys Science & Technology Championship, where he won first prize, which included a big trophy and a $500 check.

After that, he started getting a lot of attention on his Facebook page. People kept asking him if they could buy one, he said, which led to the idea of creating a company.

Lego was just for the first prototype, by the way: Future versions will be made with more traditional materials.

So how did Intel come to invest in such a young inventor? His father, Niloy, works for Intel — but that’s not exactly how it happened, according to Niloy.

After working with the beta version of Intel Edison (the chip company’s tiny embeddable microprocessor) at a summer camp, Banerjee’s project came to the attention of Intel, which invited him to show off his printer at the Intel Developer Forum. After appearing at IDF, Intel Capital came calling.

Young Banerjee seems composed in front of crowds, which should serve him well. (That’s not surprising, given that Braigo’s website touts coverage on everything from BoingBoing and SlashGear to CNN and NPR.) When asked onstage, in front of 1,000 entrepreneurs, investors, and Intel employees, how he knew that the printer worked even though he doesn’t read Braille, Banerjee answered immediately, “I Googled it.” The crowd laughed.

“I’m happy that I live in Silicon Valley,” Banerjee said. “So many smart people.”