Jump to content

connect 12 bit to 16 bit


mahbod72

Recommended Posts

Hi

I want to design basic computer with systemc and I faced a problem in my code.

The common bus of yhe basic computer is 16 bit and the address register is 12 bit. When i instantiate address register i don’t know how to connect 12 bit to 16 bit. 

AR = new reg12bit ("AR");
(*AR) (inc_ar,ld_ar,clr_ar,bus,ar2buf,clk); 

in the above Piece code the output of my register is 12 bit and the bus is 16 bit.

my idea is i use .range() but .range() just used for variables not ports or signals.

please help me.

 
Link to comment
Share on other sites

The simplest way is to write a process (SC_METHOD) to copy the values across, e.g.

SC_METHOD(copier);
sensitive << bus;

void copier() {
    myreg = bus.read().range(11,0);
}

Alternatively have a look at the sc_vector introduced in the SystemC 1666-2011 standard, which was introduced to solve this kind of problem,

 

regards

Alan

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...