Missing CHIP Keyword error when loading?! Bit.hdl

classic Classic list List threaded Threaded
4 messages Options
jrd
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Missing CHIP Keyword error when loading?! Bit.hdl

jrd
Apologies for what may be a simple question.  I keep getting this "Missing CHIP keyword" error for the Mux line when I try to load into the Hardware Simulator.  

Have checked all the forum posts related to this error message and it seems like this may somehow be related to a syntax or formatting error.  Have been working on this for hours and cannot find any problem with my syntax or hdl file.

Can you pls check my code below and explain why this error is occurring?  From all that I've read, this shouldn't be returning an error.

// This file is part of www.nand2tetris.org
// and the book "The Elements of Computing Systems"
// by Nisan and Schocken, MIT Press.
// File name: projects/03/a/Bit.hdl

/**
 * 1-bit register.
 * If load[t]=1 then out[t+1] = in[t]
 *              else out does not change (out[t+1]=out[t])
 */

CHIP Bit {
    IN in, load;
    OUT out;

    PARTS:
    Mux(a=in, b=w2, sel=load, out=w1);

}


(Note that I am not providing a complete solution to the implementation of the Bit chip - so as to to give away answer.  Only posting one chip component - which is still resulting in the "Missing CHIP Keyword" error when I load).

Thanks in advance.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing CHIP Keyword error when loading?! Bit.hdl

cadet1620
Administrator
Copying your code snippet from the post, I only get an error about missing 'w2'. If I change 'w2' to 'in' the code loads.

Typically, these weird errors come from line ending problems -- Mac/unix vs. PC -- or character encoding problems. The tools can't handle UTF or UTF-8.

If you can't find anything, email me your file as an attachment so that it doesn't get changed along the way.

--Mark
jrd
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing CHIP Keyword error when loading?! Bit.hdl

jrd
Mark:

So, made your change, but .hdl file still doesn't load in Hardware Simulator and returning same "Missing CHIP keyword" error.  I will email my .hdl file to you separately to check.  Thank you.

However, here is a quick follow-up question that may assist:

I'm working on the course on Mac OSX using the TextEdit application in pre-installed Accessories to edit the .hdl files.  TextEdit saves files I open as UTF-8 format (preserving white space option enabled).

1) Is that incorrect?

2) If #1 is incorrect/YES, which format do you recommend encoding/saving the .hdl file with so it loads properly?

3) Lastly, perhaps TextEdit isn't the best application to do this work with - if it's going to confuse the Hardware Simulator.  If so, is there an open source text editor you would specifically recommend to do the course with?

I think clarifying this will save me alot of grief and frustration I've been experiencing!  (Apologies if these answers have already been posted elsewhere.)

Thanks.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Missing CHIP Keyword error when loading?! Bit.hdl

cadet1620
Administrator
jrd wrote
So, made your change, but .hdl file still doesn't load in Hardware Simulator and returning same "Missing CHIP keyword" error.  I will email my .hdl file to you separately to check.  Thank you.

However, here is a quick follow-up question that may assist:

I'm working on the course on Mac OSX using the TextEdit application in pre-installed Accessories to edit the .hdl files.  TextEdit saves files I open as UTF-8 format (preserving white space option enabled).

1) Is that incorrect?

2) If #1 is incorrect/YES, which format do you recommend encoding/saving the .hdl file with so it loads properly?
You must save in ANSI encoding.

Also check your editor for any options for line ending characters.  The file you sent me has mixed PC and Mac line endings which might be a problem.  That may be caused by the preserve white space option.
3) Lastly, perhaps TextEdit isn't the best application to do this work with - if it's going to confuse the Hardware Simulator.  If so, is there an open source text editor you would specifically recommend to do the course with?
I'm not a Mac guy. Ybakos has in past recommended Sublime Text 2 or Textmate.


--Mark
Loading...